diff --git a/.yamllint b/.yamllint index aac6b79f2..5d79317b7 100644 --- a/.yamllint +++ b/.yamllint @@ -7,5 +7,4 @@ rules: max: 160 ignore: | - zuul.d/jobs.yaml - zuul.d/layout.yaml + zuul.d/*.yaml diff --git a/role-addition.yml b/role-addition.yml index 6bb1937dc..fe6c9f67e 100644 --- a/role-addition.yml +++ b/role-addition.yml @@ -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: diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml new file mode 100644 index 000000000..89070369d --- /dev/null +++ b/zuul.d/base.yaml @@ -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 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml deleted file mode 100644 index 61f4764b4..000000000 --- a/zuul.d/jobs.yaml +++ /dev/null @@ -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 diff --git a/zuul.d/layout.yaml b/zuul.d/layout.yaml index 974911a02..6cba7f213 100644 --- a/zuul.d/layout.yaml +++ b/zuul.d/layout.yaml @@ -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 diff --git a/zuul.d/molecule.yaml b/zuul.d/molecule.yaml new file mode 100644 index 000000000..4c2de6068 --- /dev/null +++ b/zuul.d/molecule.yaml @@ -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