Browse Source

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>
changes/99/666399/6
Alex Schultz 2 years ago
committed by Kevin Carter
parent
commit
eb3dd70fc9
No known key found for this signature in database GPG Key ID: CE94BD890A47B20A
6 changed files with 89 additions and 92 deletions
  1. +1
    -2
      .yamllint
  2. +25
    -32
      role-addition.yml
  3. +14
    -0
      zuul.d/base.yaml
  4. +0
    -51
      zuul.d/jobs.yaml
  5. +5
    -7
      zuul.d/layout.yaml
  6. +44
    -0
      zuul.d/molecule.yaml

+ 1
- 2
.yamllint View File

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

+ 25
- 32
role-addition.yml 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
- 0
zuul.d/base.yaml 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

+ 0
- 51
zuul.d/jobs.yaml 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

+ 5
- 7
zuul.d/layout.yaml 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
- 0
zuul.d/molecule.yaml 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

Loading…
Cancel
Save