aca3d5e01d
Currently the container cache preparation process uses a pre-prepared LXC base image which includes its own package repository configuration. This presents a few problems: - The first packages installed will make use of the base image's package repo configuration, resulting in a bypass of local mirrors to install the first set of packages. - A set of vars need to be set in order to have the containers use a local mirror, otherwise it'll use the mirrors set in the role's vars files. This is counterintuitive. Another problem introduced by I95c210c83ca968d11ba6f6a36b634bb798fa291f as a result of the package repository vars moving from the role defaults to the vars files is that the precedence has changed. The change in precedence means that a task which sets a fact can't be used to override the defaults set in the vars file. This method is used in all the role tests to ensure that the OpenStack-CI repositories can be discovered from the host and then used. This patch changes the image cache preparation process to ensure that the container package repository configuration matches the host configuration. This is simpler and more intuitive. Additionally the copy task from the deployment host into the container cache is set to assume the same destination in the container as the source (to reduce configuration verbosity), appropriately sets the leading '0' for the mode (to prevent unexpected surprises), and appropriately quotes the variable (to ensure forward compatibility with Ansible 2.0). Finally, the use of lxc_container_caches in the test configuration has been removed as it is no longer used. Change-Id: I420382fd3bbbb5fcae90ae0c6160233202a1a51a
141 lines
4.8 KiB
INI
141 lines
4.8 KiB
INI
[tox]
|
|
minversion = 1.6
|
|
skipsdist = True
|
|
envlist = docs,linters,functional
|
|
|
|
|
|
[testenv]
|
|
usedevelop = True
|
|
install_command = pip install -U {opts} {packages}
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = /usr/bin/find . -type f -name "*.pyc" -delete
|
|
passenv =
|
|
HOME
|
|
whitelist_externals =
|
|
bash
|
|
git
|
|
rm
|
|
wget
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
ANSIBLE_HOST_KEY_CHECKING = False
|
|
ANSIBLE_SSH_CONTROL_PATH = /tmp/%%h-%%r
|
|
# TODO (odyssey4me) These are only here as they are non-standard folder
|
|
# names for Ansible 1.9.x. We are using the standard folder names for
|
|
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
|
|
ANSIBLE_ACTION_PLUGINS = {homedir}/.ansible/plugins/action
|
|
ANSIBLE_CALLBACK_PLUGINS = {homedir}/.ansible/plugins/callback
|
|
ANSIBLE_FILTER_PLUGINS = {homedir}/.ansible/plugins/filter
|
|
ANSIBLE_LOOKUP_PLUGINS = {homedir}/.ansible/plugins/lookup
|
|
# This is required as the default is the current path or a path specified
|
|
# in ansible.cfg
|
|
ANSIBLE_LIBRARY = {homedir}/.ansible/plugins/library
|
|
# This is required as the default is '/etc/ansible/roles' or a path
|
|
# specified in ansible.cfg
|
|
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
|
|
|
|
|
|
[testenv:docs]
|
|
commands=
|
|
python setup.py build_sphinx
|
|
|
|
|
|
# environment used by the -infra templated docs job
|
|
[testenv:venv]
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = {posargs}
|
|
|
|
|
|
[testenv:pep8]
|
|
commands =
|
|
# Run hacking/flake8 check for all python files
|
|
bash -c "grep --recursive --binary-files=without-match \
|
|
--files-with-match '^.!.*python$' \
|
|
--exclude-dir .eggs \
|
|
--exclude-dir .git \
|
|
--exclude-dir .tox \
|
|
--exclude-dir *.egg-info \
|
|
--exclude-dir doc \
|
|
{toxinidir} | xargs flake8 --verbose"
|
|
|
|
[flake8]
|
|
# Ignores the following rules due to how ansible modules work in general
|
|
# F403 'from ansible.module_utils.basic import *' used;
|
|
# unable to detect undefined names
|
|
# H303 No wildcard (*) import.
|
|
ignore=F403,H303
|
|
|
|
|
|
[testenv:bashate]
|
|
commands =
|
|
# Run bashate check for all bash scripts
|
|
# Ignores the following rules:
|
|
# E003: Indent not multiple of 4 (we prefer to use multiples of 2)
|
|
# E006: Line longer than 79 columns (as many scripts use jinja
|
|
# templating, this is very difficult)
|
|
# E040: Syntax error determined using `bash -n` (as many scripts
|
|
# use jinja templating, this will often fail and the syntax
|
|
# error will be discovered in execution anyway)
|
|
bash -c "grep --recursive --binary-files=without-match \
|
|
--files-with-match '^.!.*\(ba\)\?sh$' \
|
|
--exclude-dir .tox \
|
|
--exclude-dir .git \
|
|
{toxinidir} | xargs bashate --error . --verbose --ignore=E003,E006,E040"
|
|
|
|
|
|
[testenv:ansible-syntax]
|
|
commands =
|
|
rm -rf {homedir}/.ansible
|
|
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
|
{homedir}/.ansible/plugins
|
|
ansible-galaxy install \
|
|
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
|
--ignore-errors \
|
|
--force
|
|
ansible-playbook -i {toxinidir}/tests/inventory \
|
|
--syntax-check \
|
|
--list-tasks \
|
|
-e "rolename={toxinidir}" \
|
|
{toxinidir}/tests/test.yml
|
|
|
|
|
|
[testenv:ansible-lint]
|
|
commands =
|
|
rm -rf {homedir}/.ansible
|
|
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
|
{homedir}/.ansible/plugins
|
|
ansible-galaxy install \
|
|
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
|
--ignore-errors \
|
|
--force
|
|
ansible-lint {toxinidir}/tests/test.yml
|
|
|
|
|
|
[testenv:functional]
|
|
commands =
|
|
rm -rf {homedir}/.ansible
|
|
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
|
|
{homedir}/.ansible/plugins
|
|
# This plugin makes the ansible-playbook output easier to read
|
|
wget -O {homedir}/.ansible/plugins/callback/human_log.py \
|
|
https://gist.githubusercontent.com/cliffano/9868180/raw/f360f306b3c6d689734a6aa8773a00edf16a0054/human_log.py
|
|
ansible-galaxy install \
|
|
--role-file={toxinidir}/tests/ansible-role-requirements.yml \
|
|
--ignore-errors \
|
|
--force
|
|
ansible-playbook -i {toxinidir}/tests/inventory \
|
|
-e "rolename={toxinidir}" \
|
|
-vv \
|
|
{toxinidir}/tests/test.yml
|
|
|
|
|
|
[testenv:linters]
|
|
commands =
|
|
{[testenv:pep8]commands}
|
|
{[testenv:bashate]commands}
|
|
{[testenv:ansible-lint]commands}
|
|
{[testenv:ansible-syntax]commands}
|
|
|
|
[testenv:releasenotes]
|
|
commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|