Fix diskimage-create tox, add `build
and
test
` targets
Improve end user experience with building a Octavia Amphora diskimage through tox/virtualenv. Change-Id: I8672d039a5b7ded57323aeb99f484fe7f2838fef Task: 29059 Story: 2004847
This commit is contained in:
parent
838719a09a
commit
d1518c5c79
@ -48,7 +48,7 @@ Ubuntu
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ sudo apt install qemu git kpartx debootstrap
|
||||
$ sudo apt install qemu-utils git kpartx debootstrap
|
||||
|
||||
Fedora, CentOS and Red Hat Enterprise Linux
|
||||
|
||||
@ -228,6 +228,18 @@ an OSP repository):
|
||||
|
||||
$ export REG_SAT_URL="<satellite url>" REG_ORG="<satellite org>"
|
||||
|
||||
Building in a virtualenv with tox
|
||||
---------------------------------
|
||||
To make use of a virtualenv for Python dependencies you may run ``tox``. Note that
|
||||
you may still need to install binary dependencies on the host for the build to succeed.
|
||||
|
||||
If you wish to customize your build modify ``tox.ini`` to pass on relevant
|
||||
environment variables or command line arguments to the ``diskimage-create.sh`` script.
|
||||
|
||||
.. code:: bash
|
||||
|
||||
$ tox -e build
|
||||
|
||||
|
||||
Container Support
|
||||
=================
|
||||
|
@ -284,10 +284,11 @@ fi
|
||||
|
||||
# Make sure we have the required packages installed
|
||||
if [ "$platform" = 'NAME="Ubuntu"' ]; then
|
||||
PKG_LIST="qemu git"
|
||||
PKG_LIST="qemu-utils git kpartx debootstrap"
|
||||
for pkg in $PKG_LIST; do
|
||||
if ! dpkg --get-selections | grep -q "^$pkg[[:space:]]*install$" >/dev/null; then
|
||||
echo "Required package " $pkg " is not installed. Exiting."
|
||||
echo "Binary dependencies on this platform are: ${PKG_LIST}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@ -307,6 +308,7 @@ elif [[ $platform =~ "SUSE" ]]; then
|
||||
for pkg in $PKG_LIST; do
|
||||
if ! rpm -q $pkg &> /dev/null; then
|
||||
echo "Required package " ${pkg/\*} " is not installed. Exiting."
|
||||
echo "Binary dependencies on this platform are: ${PKG_LIST}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@ -318,6 +320,7 @@ else
|
||||
for pkg in $PKG_LIST; do
|
||||
if ! rpm -qa $pkg ; then
|
||||
echo "Required package " ${pkg/\*} " is not installed. Exiting."
|
||||
echo "Binary dependencies on this platform are: ${PKG_LIST}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
@ -1,10 +1,13 @@
|
||||
[tox]
|
||||
minversion = 1.8
|
||||
envlist = bashate,docs,py27
|
||||
envlist = bashate,docs,build,test
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
envdir = {toxworkdir}/venv
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
|
||||
install_command = pip install -U {opts} {packages}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
@ -13,12 +16,6 @@ whitelist_externals = virt-filesystems
|
||||
awk
|
||||
mkdir
|
||||
rm
|
||||
commands = mkdir -p {toxinidir}/.amp_tox_test
|
||||
./diskimage-create.sh -o {toxinidir}/.amp_tox_test/amphora-x64-haproxy -w {toxworkdir}
|
||||
# Work around tox limitations with command pipes
|
||||
# https://bitbucket.org/hpk42/tox/issue/73/pipe-output-of-command-into-file
|
||||
./image-tests.sh {toxinidir}/.amp_tox_test
|
||||
rm -rf {toxinidir}/.amp_tox_test
|
||||
|
||||
[testenv:docs]
|
||||
commands = doc8 README.rst ../elements/haproxy-octavia/README.rst ../elements/root-passwd/README.rst
|
||||
@ -27,3 +24,14 @@ commands = doc8 README.rst ../elements/haproxy-octavia/README.rst ../elements/ro
|
||||
commands = bashate diskimage-create.sh
|
||||
bashate image-tests.sh
|
||||
|
||||
[testenv:build]
|
||||
# NOTE: specify cache directory explicitly with -c as the `diskimage-create.sh`
|
||||
# default is based off of `$HOME` which is not passed on in a `tox` environment.
|
||||
commands = mkdir -p {toxinidir}/.amp_tox_test
|
||||
./diskimage-create.sh -o {toxinidir}/.amp_tox_test/amphora-x64-haproxy -w {toxworkdir} -c {toxworkdir}/.cache
|
||||
|
||||
[testenv:test]
|
||||
# Work around tox limitations with command pipes
|
||||
# https://bitbucket.org/hpk42/tox/issue/73/pipe-output-of-command-into-file
|
||||
commands = ./image-tests.sh {toxinidir}/.amp_tox_test
|
||||
rm -rf {toxinidir}/.amp_tox_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user