From c5e55d75b35f79ae26aeaf61a818100f2d999e23 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Wed, 3 May 2017 19:25:24 +0200 Subject: [PATCH] Import playbooks from feature/zuulv3 development We have been using the following ansible playbooks for testing feature/zuulv3 of zuul. This commit copies the playbooks from zuul and imports them here. Change-Id: Ib776cdce10b1f05501c46f6cf359723960f1bc71 Depends-On: I11da723df8823091f25e2a630e80ee4270d99a9b Depends-On: Ic03634dd02d2eb1fa5aa8a38f4beb5f0ec5582c6 Co-Authored-By: Andreas Jaeger Signed-off-by: Paul Belanger --- .zuul.yaml | 50 ++++++++++++++++++++++++++++++++- playbooks/base/post.yaml | 13 +++++++++ playbooks/base/pre.yaml | 3 ++ playbooks/tox/cover.yaml | 5 ++++ playbooks/tox/docs.yaml | 4 +++ playbooks/tox/linters.yaml | 6 ++++ playbooks/tox/post.yaml | 17 +++++++++++ playbooks/tox/pre.yaml | 3 ++ playbooks/tox/py27.yaml | 7 +++++ playbooks/tox/tarball-post.yaml | 10 +++++++ playbooks/tox/tarball.yaml | 5 ++++ test-requirements.txt | 2 ++ tox.ini | 31 ++++++++++++++++++++ 13 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 playbooks/base/post.yaml create mode 100644 playbooks/base/pre.yaml create mode 100644 playbooks/tox/cover.yaml create mode 100644 playbooks/tox/docs.yaml create mode 100644 playbooks/tox/linters.yaml create mode 100644 playbooks/tox/post.yaml create mode 100644 playbooks/tox/pre.yaml create mode 100644 playbooks/tox/py27.yaml create mode 100644 playbooks/tox/tarball-post.yaml create mode 100644 playbooks/tox/tarball.yaml create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.zuul.yaml b/.zuul.yaml index 8657f333..be8dcee8 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,5 +1,53 @@ +- job: + name: base + pre-run: base/pre + post-run: base/post + roles: + - zuul: openstack-infra/openstack-zuul-roles + success-url: http://zuulv3-dev.openstack.org/logs/{build.uuid}/ + failure-url: http://zuulv3-dev.openstack.org/logs/{build.uuid}/ + timeout: 1800 + vars: + zuul_workspace_root: /home/zuul + nodes: + - name: ubuntu-xenial + image: ubuntu-xenial + +- job: + name: tox + parent: base + pre-run: tox/pre + post-run: tox/post + +- job: + name: tox-cover + parent: tox + run: tox/cover + voting: false + +- job: + name: tox-docs + parent: tox + run: tox/docs + +- job: + name: tox-linters + parent: tox + run: tox/linters + +- job: + name: tox-py27 + parent: tox + run: tox/py27 + +- job: + name: tox-tarball + parent: tox + run: tox/tarball + post-run: tox/tarball-post + - project: name: openstack-infra/openstack-zuul-jobs check: jobs: - - noop + - tox-linters diff --git a/playbooks/base/post.yaml b/playbooks/base/post.yaml new file mode 100644 index 00000000..ed3f7b8c --- /dev/null +++ b/playbooks/base/post.yaml @@ -0,0 +1,13 @@ +- hosts: all + tasks: + - name: Collect console log. + synchronize: + dest: "{{ zuul.executor.log_root }}" + mode: pull + src: "/tmp/console.log" + + - name: Publish logs. + copy: + dest: "/opt/zuul-logs/{{ zuul.uuid}}" + src: "{{ zuul.executor.log_root }}/" + delegate_to: 127.0.0.1 diff --git a/playbooks/base/pre.yaml b/playbooks/base/pre.yaml new file mode 100644 index 00000000..1a2e699b --- /dev/null +++ b/playbooks/base/pre.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - prepare-workspace diff --git a/playbooks/tox/cover.yaml b/playbooks/tox/cover.yaml new file mode 100644 index 00000000..642eb4e4 --- /dev/null +++ b/playbooks/tox/cover.yaml @@ -0,0 +1,5 @@ +- hosts: all + roles: + - extra-test-setup + - revoke-sudo + - run-cover diff --git a/playbooks/tox/docs.yaml b/playbooks/tox/docs.yaml new file mode 100644 index 00000000..028e1c51 --- /dev/null +++ b/playbooks/tox/docs.yaml @@ -0,0 +1,4 @@ +- hosts: all + roles: + - revoke-sudo + - run-docs diff --git a/playbooks/tox/linters.yaml b/playbooks/tox/linters.yaml new file mode 100644 index 00000000..d1e7f130 --- /dev/null +++ b/playbooks/tox/linters.yaml @@ -0,0 +1,6 @@ +- hosts: all + vars: + run_tox_envlist: pep8 + roles: + - revoke-sudo + - run-tox diff --git a/playbooks/tox/post.yaml b/playbooks/tox/post.yaml new file mode 100644 index 00000000..4e637d85 --- /dev/null +++ b/playbooks/tox/post.yaml @@ -0,0 +1,17 @@ +- hosts: all + tasks: + - name: Find tox directories to synchrionize. + find: + file_type: directory + paths: "{{ zuul_workspace_root }}/src/{{ zuul.project.canonical_name }}/.tox" + # NOTE(pabelanger): The .tox/log folder is empty, ignore it. + patterns: ^(?!log).*$ + use_regex: yes + register: result + + - name: Collect tox logs. + synchronize: + dest: "{{ zuul.executor.log_root }}/tox" + mode: pull + src: "{{ item.path }}/log/" + with_items: "{{ result.files }}" diff --git a/playbooks/tox/pre.yaml b/playbooks/tox/pre.yaml new file mode 100644 index 00000000..0bf9b3ce --- /dev/null +++ b/playbooks/tox/pre.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - run-bindep diff --git a/playbooks/tox/py27.yaml b/playbooks/tox/py27.yaml new file mode 100644 index 00000000..fd45f271 --- /dev/null +++ b/playbooks/tox/py27.yaml @@ -0,0 +1,7 @@ +- hosts: all + vars: + run_tox_envlist: py27 + roles: + - extra-test-setup + - revoke-sudo + - run-tox diff --git a/playbooks/tox/tarball-post.yaml b/playbooks/tox/tarball-post.yaml new file mode 100644 index 00000000..a3c125fa --- /dev/null +++ b/playbooks/tox/tarball-post.yaml @@ -0,0 +1,10 @@ +- hosts: all + tasks: + - name: Collect tarball artifacts. + synchronize: + dest: "{{ zuul.executor.src_root }}/tarballs" + mode: pull + src: "{{ zuul_workspace_root }}/src/{{ zuul.project.canonical_name }}/dist/{{ item }}" + with_items: + - "*.tar.gz" + - "*.whl" diff --git a/playbooks/tox/tarball.yaml b/playbooks/tox/tarball.yaml new file mode 100644 index 00000000..4d5a8f61 --- /dev/null +++ b/playbooks/tox/tarball.yaml @@ -0,0 +1,5 @@ +- hosts: all + roles: + - revoke-sudo + - run-tarball + - run-wheel diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..7214687c --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +hacking>=0.10,<0.11 +bashate>=0.2 diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..5c6985ca --- /dev/null +++ b/tox.ini @@ -0,0 +1,31 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = pep8, py27 + +[testenv] +install_command = pip install {opts} {packages} +deps = -r{toxinidir}/test-requirements.txt +commands = + python setup.py testr --slowest --testr-args='{posargs}' + +[testenv:bindep] +# Do not install any requirements. We want this to be fast and work even if +# system dependencies are missing, since it's used to tell you what system +# dependencies are missing! This also means that bindep must be installed +# separately, outside of the requirements files. +deps = bindep +commands = bindep test + +[testenv:pep8] +commands = flake8 {posargs} + +[testenv:venv] +commands = {posargs} + +[flake8] +# These are ignored intentionally in openstack-infra projects; +# please don't submit patches that solely correct them or enable them. +ignore = E125,E129,H +show-source = True +exclude = .venv,.tox,dist,doc,build,*.egg