summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Stanley <fungi@yuggoth.org>2017-12-06 18:24:52 +0000
committerJeremy Stanley <fungi@yuggoth.org>2017-12-20 17:48:17 +0000
commitab5c4064e7aaece18a5aaf573a39b32266caad3b (patch)
tree737b99258e13fa4e4ea19d191af6993a35b730bc
parent5d5813a7f6a3b1fe6496109d81681d557fed9b55 (diff)
Add generic base and base-test jobs/playbooks
Start with a stripped-down fork of the base job from project-config, omitting any OpenStack-specific roles and variables. Also include a duplicate base-test job intended for testing out potential changes to the base job. Extend the linters env for tox to check the included playbooks with ansible-lint, and add Sphinx integration for autodocumenting the new playbooks. Change-Id: I575be518c3e549a51c0c94deb295061dcf8be0b5
Notes
Notes (review): Code-Review+2: James E. Blair <corvus@inaugust.com> Code-Review+2: Andreas Jaeger <jaegerandi@gmail.com> Workflow+1: Andreas Jaeger <jaegerandi@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 21 Dec 2017 05:30:05 +0000 Reviewed-on: https://review.openstack.org/526140 Project: openstack-infra/zuul-base-jobs Branch: refs/heads/master
-rwxr-xr-xdoc/source/conf.py1
-rw-r--r--doc/source/index.rst2
-rw-r--r--doc/source/jobs.rst5
-rw-r--r--playbooks/base-test/post-ssh.yaml3
-rw-r--r--playbooks/base-test/pre.yaml4
-rw-r--r--playbooks/base/post-ssh.yaml3
-rw-r--r--playbooks/base/pre.yaml4
-rw-r--r--tox.ini26
-rw-r--r--zuul.yaml28
9 files changed, 76 insertions, 0 deletions
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
22extensions = [ 22extensions = [
23 'sphinx.ext.autodoc', 23 'sphinx.ext.autodoc',
24 #'sphinx.ext.intersphinx', 24 #'sphinx.ext.intersphinx',
25 'zuul_sphinx',
25] 26]
26 27
27# autodoc generation is a bit aggressive and a nuisance when doing heavy 28# 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 @@
4.. toctree:: 4.. toctree::
5 :maxdepth: 2 5 :maxdepth: 2
6 6
7 jobs
8
7Indices and tables 9Indices and tables
8================== 10==================
9 11
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 @@
1Jobs
2=====
3
4.. zuul:autojobs::
5
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 @@
1- hosts: all
2 roles:
3 - 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 @@
1- hosts: all
2 roles:
3 - add-build-sshkey
4 - 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 @@
1- hosts: all
2 roles:
3 - 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 @@
1- hosts: all
2 roles:
3 - add-build-sshkey
4 - 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
22commands = python setup.py build_sphinx 22commands = python setup.py build_sphinx
23 23
24[testenv:linters] 24[testenv:linters]
25basepython = python3
26whitelist_externals = bash
27setenv =
28 ANSIBLE_LIBRARY= {envdir}/src/zuul/zuul/ansible/library
29passenv =
30 # NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need
31 # to export ANSIBLE_ROLES_PATH pointing to the currect repos.
32 # see infra-zuul-jobs-linters job for more information.
33 ANSIBLE_ROLES_PATH
34# Add dependencies here since other jobs use python2 and zuul requires
35# python3.
36deps =
37 # Zuul is required to supply the zuul ansible modules for ansible-lint
38 -egit+https://git.openstack.org/openstack-infra/zuul@feature/zuulv3#egg=zuul
39 ansible<2.4.0
40 ansible-lint
41 hacking>=0.10,<0.11
42 bashate>=0.2
25commands = 43commands =
26 flake8 {posargs} 44 flake8 {posargs}
45 # Ansible lint
46 # [ANSIBLE0012] Commands should not change things if nothing needs doing
47 bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \
48 xargs -t -n1 -0 ansible-lint -xANSIBLE0012"
49 # Ansible Syntax Check
50 bash -c "find playbooks -type f -regex '.*.ya?ml' -exec \
51 ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \
52 \{\} + > /dev/null"
27 53
28[testenv:venv] 54[testenv:venv]
29commands = {posargs} 55commands = {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 @@
1- job:
2 name: base
3 parent: null
4 description: |
5 The recommended base job.
6
7 All jobs ultimately inherit from this. It runs a pre-playbook
8 which copies all of the job's prepared git repos on to all of
9 the nodes in the nodeset.
10
11 It also sets a default timeout value (which may be overidden).
12 pre-run: playbooks/base/pre.yaml
13 post-run: playbooks/base/post-ssh.yaml
14 roles:
15 - zuul: openstack-infra/zuul-jobs
16 timeout: 1800
17
18- job:
19 name: base-test
20 parent: null
21 description: |
22 A job to test changes to the base job without disturbing the
23 main job in production. Not for general use.
24 pre-run: playbooks/base-test/pre.yaml
25 post-run: playbooks/base-test/post-ssh.yaml
26 roles:
27 - zuul: openstack-infra/zuul-jobs
28 timeout: 1800