diff --git a/doc/source/conf.py b/doc/source/conf.py index 4f4fe12..3188908 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,6 +22,7 @@ import sys extensions = [ 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', + 'zuul_sphinx', ] # autodoc generation is a bit aggressive and a nuisance when doing heavy diff --git a/doc/source/index.rst b/doc/source/index.rst index 16d16c4..8f16b3b 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,6 +4,8 @@ .. toctree:: :maxdepth: 2 + jobs + Indices and tables ================== diff --git a/doc/source/jobs.rst b/doc/source/jobs.rst new file mode 100644 index 0000000..1d722cb --- /dev/null +++ b/doc/source/jobs.rst @@ -0,0 +1,5 @@ +Jobs +===== + +.. zuul:autojobs:: + diff --git a/playbooks/base-test/post-ssh.yaml b/playbooks/base-test/post-ssh.yaml new file mode 100644 index 0000000..d793838 --- /dev/null +++ b/playbooks/base-test/post-ssh.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - remove-build-sshkey diff --git a/playbooks/base-test/pre.yaml b/playbooks/base-test/pre.yaml new file mode 100644 index 0000000..a5a3f4f --- /dev/null +++ b/playbooks/base-test/pre.yaml @@ -0,0 +1,4 @@ +- hosts: all + roles: + - add-build-sshkey + - prepare-workspace diff --git a/playbooks/base/post-ssh.yaml b/playbooks/base/post-ssh.yaml new file mode 100644 index 0000000..d793838 --- /dev/null +++ b/playbooks/base/post-ssh.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - remove-build-sshkey diff --git a/playbooks/base/pre.yaml b/playbooks/base/pre.yaml new file mode 100644 index 0000000..a5a3f4f --- /dev/null +++ b/playbooks/base/pre.yaml @@ -0,0 +1,4 @@ +- hosts: all + roles: + - add-build-sshkey + - prepare-workspace diff --git a/tox.ini b/tox.ini index ce97e9c..b70aa42 100644 --- a/tox.ini +++ b/tox.ini @@ -22,8 +22,34 @@ commands = bindep test commands = python setup.py build_sphinx [testenv:linters] +basepython = python3 +whitelist_externals = bash +setenv = + ANSIBLE_LIBRARY= {envdir}/src/zuul/zuul/ansible/library +passenv = + # NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need + # to export ANSIBLE_ROLES_PATH pointing to the currect repos. + # see infra-zuul-jobs-linters job for more information. + ANSIBLE_ROLES_PATH +# Add dependencies here since other jobs use python2 and zuul requires +# python3. +deps = + # Zuul is required to supply the zuul ansible modules for ansible-lint + -egit+https://git.openstack.org/openstack-infra/zuul@feature/zuulv3#egg=zuul + ansible<2.4.0 + ansible-lint + hacking>=0.10,<0.11 + bashate>=0.2 commands = flake8 {posargs} + # Ansible lint + # [ANSIBLE0012] Commands should not change things if nothing needs doing + bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \ + xargs -t -n1 -0 ansible-lint -xANSIBLE0012" + # Ansible Syntax Check + bash -c "find playbooks -type f -regex '.*.ya?ml' -exec \ + ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \ + \{\} + > /dev/null" [testenv:venv] commands = {posargs} diff --git a/zuul.yaml b/zuul.yaml new file mode 100644 index 0000000..310c297 --- /dev/null +++ b/zuul.yaml @@ -0,0 +1,28 @@ +- job: + name: base + parent: null + description: | + The recommended base job. + + All jobs ultimately inherit from this. It runs a pre-playbook + which copies all of the job's prepared git repos on to all of + the nodes in the nodeset. + + It also sets a default timeout value (which may be overidden). + pre-run: playbooks/base/pre.yaml + post-run: playbooks/base/post-ssh.yaml + roles: + - zuul: openstack-infra/zuul-jobs + timeout: 1800 + +- job: + name: base-test + parent: null + description: | + A job to test changes to the base job without disturbing the + main job in production. Not for general use. + pre-run: playbooks/base-test/pre.yaml + post-run: playbooks/base-test/post-ssh.yaml + roles: + - zuul: openstack-infra/zuul-jobs + timeout: 1800