diff --git a/.zuul.d/jobs-tox.yaml b/.zuul.d/jobs-tox.yaml index b150f29..5eb8f16 100644 --- a/.zuul.d/jobs-tox.yaml +++ b/.zuul.d/jobs-tox.yaml @@ -1,7 +1,7 @@ - job: - name: windmill-tox-deploy - parent: tox - run: tests/playbooks/tox/run.yaml + name: windmill-tox-ubuntu-xenial + pre-run: tests/playbooks/pre.yaml + run: tests/playbooks/run.yaml nodeset: ubuntu-xenial required-projects: - openstack/ansible-role-diskimage-builder @@ -15,6 +15,3 @@ - openstack/ansible-role-virtualenv - openstack/ansible-role-zookeeper - openstack/ansible-role-zuul - vars: - tox_envlist: deploy - tox_extra_args: '-vv -- --extra-vars "@tests/extra-vars.yaml"' diff --git a/.zuul.d/projects.yaml b/.zuul.d/projects.yaml index 250eab6..f4e460e 100644 --- a/.zuul.d/projects.yaml +++ b/.zuul.d/projects.yaml @@ -6,7 +6,7 @@ - windmill-jobs-xenial check: jobs: - - windmill-tox-deploy + - windmill-tox-ubuntu-xenial gate: jobs: - - windmill-tox-deploy + - windmill-tox-ubuntu-xenial diff --git a/playbooks/ansible.cfg b/tests/ansible.cfg similarity index 100% rename from playbooks/ansible.cfg rename to tests/ansible.cfg diff --git a/tests/playbooks/pre.yaml b/tests/playbooks/pre.yaml new file mode 100644 index 0000000..1c03918 --- /dev/null +++ b/tests/playbooks/pre.yaml @@ -0,0 +1,18 @@ +- hosts: all + tasks: + - name: Bootstrap tox environment + args: + chdir: "{{ zuul.project.src_dir }}" + command: tox -evenv --notest + + - name: Install bindep dependendies + args: + chdir: "{{ zuul.project.src_dir }}" + executable: /bin/bash + shell: source .tox/venv/bin/activate; ./tools/install_bindep.sh + + - name: Install ansible roles via galaxy + args: + chdir: "{{ zuul.project.src_dir }}" + executable: /bin/bash + shell: source .tox/venv/bin/activate; ./tools/install_roles.sh diff --git a/tests/playbooks/run.yaml b/tests/playbooks/run.yaml new file mode 100644 index 0000000..810c9b8 --- /dev/null +++ b/tests/playbooks/run.yaml @@ -0,0 +1,11 @@ +- hosts: all + tasks: + - name: Bootstrap bastion node using ansible + args: + chdir: "{{ zuul.project.src_dir }}" + shell: tox -evenv -- ansible-playbook -i inventory/single-node playbooks/bastion.yaml + + - name: Run ansible-playbook + args: + chdir: "{{ zuul.project.src_dir }}" + shell: tox -evenv -- ansible-playbook -i inventory/single-node playbooks/site.yaml --extra-vars "@tests/extra-vars.yaml" diff --git a/tests/playbooks/tox/run.yaml b/tests/playbooks/tox/run.yaml deleted file mode 100644 index 22f8209..0000000 --- a/tests/playbooks/tox/run.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- hosts: all - roles: - - tox diff --git a/tox.ini b/tox.ini index da8ed92..56c0e3b 100644 --- a/tox.ini +++ b/tox.ini @@ -15,22 +15,6 @@ deps = -r{toxinidir}/requirements.txt deps = bindep commands = bindep test -[testenv:deploy] -deps = -r{toxinidir}/requirements.txt -commands = - {toxinidir}/tools/install_bindep.sh - {toxinidir}/tools/install_roles.sh - # NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI. - ansible-playbook -i inventory/single-node playbooks/bastion.yaml {posargs} - ansible-playbook -i inventory/single-node playbooks/site.yaml {posargs} -passenv = - HOME - SSH_AUTH_SOCK - USER -setenv = - ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg - PYTHONUNBUFFERED = 1 - [testenv:docs] commands = python setup.py build_sphinx @@ -43,6 +27,13 @@ commands = [testenv:venv] commands = {posargs} +passenv = + HOME + SSH_AUTH_SOCK + USER +setenv = + ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg + PYTHONUNBUFFERED = 1 [flake8] # E123, E125 skipped as they are invalid PEP-8.