Re-organize zuul config

To simplify the configuration, let's move the molecule jobs to their own
file and leverage a template for inclusion into the main zuul config.

Change-Id: I5c1a5b600f1d77b1375e9c4ed3cbabccf3196c17
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Alex Schultz 2019-06-19 10:52:53 -06:00 committed by Kevin Carter
parent 1a6e7e47ef
commit eb3dd70fc9
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
6 changed files with 89 additions and 92 deletions

View File

@ -7,5 +7,4 @@ rules:
max: 160
ignore: |
zuul.d/jobs.yaml
zuul.d/layout.yaml
zuul.d/*.yaml

View File

@ -50,57 +50,50 @@
- key: "commands"
value: "python -m pytest --color=yes --html={envlogdir}/reports.html --self-contained-html {tty:-s} {toxinidir}/tests/test_molecule.py"
- name: Read zuul jobs file
- name: Read zuul molecule file
slurp:
src: zuul.d/jobs.yaml
register: jobs_yaml
src: zuul.d/molecule.yaml
register: molecule_yaml
- name: Create jobs entry
- name: Create molecule entry
copy:
content: |-
---
{% set jobs = jobs_yaml['content'] | b64decode | from_yaml %}
{% set items = molecule_yaml['content'] | b64decode | from_yaml %}
{% set job_index = [] %}
{% for job in jobs %}
{% if job.job.name == "tripleo-ansible-centos:mol-" ~ role_name %}
{% set _ = job_index.append("tripleo-ansible-centos:mol-" ~ role_name) %}
{% set new_job_name = "tripleo-ansible-centos-7-molecule-" ~ role_name %}
{% for item in items %}
{% if 'project-template' in item %}
{% if item['project-template']['name'] == "tripleo-ansible-molecule-jobs" %}
{% if not (new_job_name in item['project-template']['check']['jobs']) %}
{% set _ = item['project-template']['check']['jobs'].append(new_job_name) %}
{% endif %}
{% if not (new_job_name in item['project-template']['gate']['jobs']) %}
{% set _ = item['project-template']['gate']['jobs'].append(new_job_name) %}
{% endif %}
{% endif %}
{% else %}
{% if item['job']['name'] == new_job_name %}
{% set _ = job_index.append(new_job_name) %}
{% endif %}
{% endif %}
{% endfor %}
{% if (job_index | length) < 1 %}
{% set new_job = {
"name": "tripleo-ansible-centos-7-molecule-" ~ role_name,
"name": new_job_name,
"parent": "tripleo-ansible-centos",
"files": [
"^tripleo_ansible/roles/" ~ role_name ~ "/.*"
"^roles/" ~ role_name ~ "/.*"
],
"vars": {
"tox_envlist": "mol-" ~ role_name
}
}
%}
{% set _ = jobs.append({"job": new_job}) %}
{% set _ = items.append({"job": new_job}) %}
{% endif %}
{{ jobs | to_nice_yaml(indent=2, width=1337) }}
dest: zuul.d/jobs.yaml
- name: Read zuul layout file
slurp:
src: zuul.d/layout.yaml
register: layout_yaml
- name: Create jobs entry
copy:
content: |-
---
{% set layouts = layout_yaml['content'] | b64decode | from_yaml %}
{% set new_job_name = "tripleo-ansible-centos-7-molecule-" ~ role_name %}
{% for layout in layouts %}
{% if not (new_job_name in layout.project.check.jobs) %}
{% set _ = layout.project.check.jobs.append(new_job_name) %}
{% endif %}
{% endfor %}
{{ layouts | to_nice_yaml(indent=2, width=1337) }}
dest: zuul.d/layout.yaml
{{ items | to_nice_yaml(indent=2, width=1337) }}
dest: zuul.d/molecule.yaml
- name: Create role documentation
copy:

14
zuul.d/base.yaml Normal file
View File

@ -0,0 +1,14 @@
---
- job:
name: tripleo-ansible-centos
parent: tox-molecule
description: Basic tripleo-ansible tox job
timeout: 900
nodeset: centos-7
voting: true
- job:
name: tripleo-ansible-docs
parent: openstack-tox-docs
files:
- ^doc/.*
- ^README.rst

View File

@ -1,51 +0,0 @@
---
- job:
name: tripleo-ansible-centos
parent: tox-molecule
description: Basic tripleo-ansible tox job
timeout: 900
nodeset: centos-7
voting: true
- job:
name: tripleo-ansible-docs
parent: openstack-tox-docs
files:
- ^tripleo_ansible/doc/.*
- ^tripleo_ansible/README.rst
- job:
name: tripleo-ansible-centos-7-molecule-aide
parent: tripleo-ansible-centos
files:
- ^tripleo_ansible/roles/aide/.*
vars:
tox_envlist: mol-aide
- job:
name: tripleo-ansible-centos-7-molecule-test_deps
parent: tripleo-ansible-centos
files:
- ^tripleo_ansible/roles/test_deps/.*
vars:
tox_envlist: mol-test_deps
- job:
name: tripleo-ansible-centos-7-molecule-test_package_action
parent: tripleo-ansible-centos
files:
- ^tripleo_ansible/roles/test_package_action/.*
- ^tripleo-ansible/tripleo_ansible/ansible_plugins/action/package.py
vars:
tox_envlist: mol-test_package_action
- job:
name: tripleo-ansible-centos-7-molecule-tuned
parent: tripleo-ansible-centos
description: |
Run molecule tests. Uses tox with the ``mol-tuned`` environment.
voting: true
files:
- ^tripleo_ansible/roles/tuned/.*
vars:
tox_envlist: mol-tuned

View File

@ -1,19 +1,17 @@
---
- project:
templates:
- publish-openstack-docs-pti
- release-notes-jobs-python3
- tripleo-ansible-molecule-jobs
check:
jobs:
- openstack-tox-linters
- tripleo-ansible-centos-7-molecule-aide
- tripleo-ansible-centos-7-molecule-test_deps
- tripleo-ansible-centos-7-molecule-test_package_action
- tripleo-ansible-centos-7-molecule-tuned
- tripleo-ansible-docs
gate:
jobs:
- openstack-tox-linters
- tripleo-ansible-docs
post:
jobs:
- publish-openstack-python-branch-tarball
templates:
- publish-openstack-docs-pti
- release-notes-jobs-python3

44
zuul.d/molecule.yaml Normal file
View File

@ -0,0 +1,44 @@
---
- project-template:
check:
jobs:
- tripleo-ansible-centos-7-molecule-aide
- tripleo-ansible-centos-7-molecule-test_deps
- tripleo-ansible-centos-7-molecule-test_package_action
- tripleo-ansible-centos-7-molecule-tuned
gate:
jobs:
- tripleo-ansible-centos-7-molecule-aide
- tripleo-ansible-centos-7-molecule-test_deps
- tripleo-ansible-centos-7-molecule-test_package_action
- tripleo-ansible-centos-7-molecule-tuned
name: tripleo-ansible-molecule-jobs
- job:
files:
- ^roles/aide/.*
name: tripleo-ansible-centos-7-molecule-aide
parent: tripleo-ansible-centos
vars:
tox_envlist: mol-aide
- job:
files:
- ^roles/test_deps/.*
name: tripleo-ansible-centos-7-molecule-test_deps
parent: tripleo-ansible-centos
vars:
tox_envlist: mol-test_deps
- job:
files:
- ^ansible_plugins/action/package.py
- ^roles/test_package_action/.*
name: tripleo-ansible-centos-7-molecule-test_package_action
parent: tripleo-ansible-centos
vars:
tox_envlist: mol-test_package_action
- job:
files:
- ^roles/tuned/.*
name: tripleo-ansible-centos-7-molecule-tuned
parent: tripleo-ansible-centos
vars:
tox_envlist: mol-tuned