From 1f40084de7410545b58c774e8966121761dc5977 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mar 17 2020 11:18:09 +0000 Subject: [PATCH 1/3] Add check-for-tests: conditionnal job --- diff --git a/playbooks/rpm/check-for-tests.yaml b/playbooks/rpm/check-for-tests.yaml new file mode 100644 index 0000000..a1f3478 --- /dev/null +++ b/playbooks/rpm/check-for-tests.yaml @@ -0,0 +1,18 @@ +--- +- hosts: all + tasks: + - name: Check fo tests/tests.yml exists + stat: + path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/tests.yml" + register: tests_stat + - zuul_return: + data: + zuul: + child_jobs: + - rpm-test + when: tests_stat.stat.exists + - zuul_return: + data: + zuul: + child_jobs: [] + when: not tests_stat.stat.exists diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 8222f06..dcd379b 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -1,6 +1,14 @@ --- ### rpm-test ### - job: + name: check-for-tests + parent: null + nodeset: + nodes: [] + description: Check the project has a tests/tests.yml + run: playbooks/rpm/check-for-tests.yaml + +- job: name: base-rpm-test description: Run the test.yml test parent: base-cloud-fedora-latest diff --git a/zuul.d/templates.yaml b/zuul.d/templates.yaml index 28b6efb..201597e 100644 --- a/zuul.d/templates.yaml +++ b/zuul.d/templates.yaml @@ -21,8 +21,10 @@ name: test check: jobs: + - check-for-tests - rpm-test: dependencies: + - check-for-tests - rpm-scratch-build - project-template: From 3636d763c59ea3be0fc0e28c7241415b1fc300e4 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mar 17 2020 11:18:09 +0000 Subject: [PATCH 2/3] Move check-for-tests job in config project --- diff --git a/playbooks/rpm/check-for-tests.yaml b/playbooks/rpm/check-for-tests.yaml deleted file mode 100644 index a1f3478..0000000 --- a/playbooks/rpm/check-for-tests.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- hosts: all - tasks: - - name: Check fo tests/tests.yml exists - stat: - path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/tests.yml" - register: tests_stat - - zuul_return: - data: - zuul: - child_jobs: - - rpm-test - when: tests_stat.stat.exists - - zuul_return: - data: - zuul: - child_jobs: [] - when: not tests_stat.stat.exists diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index dcd379b..8222f06 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -1,14 +1,6 @@ --- ### rpm-test ### - job: - name: check-for-tests - parent: null - nodeset: - nodes: [] - description: Check the project has a tests/tests.yml - run: playbooks/rpm/check-for-tests.yaml - -- job: name: base-rpm-test description: Run the test.yml test parent: base-cloud-fedora-latest From 816681b2285b91ef08d3a1e0b1b4aeaec68165d4 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mar 17 2020 13:32:31 +0000 Subject: [PATCH 3/3] check-for-tests job ensure run after scratch-build job --- diff --git a/zuul.d/templates.yaml b/zuul.d/templates.yaml index 201597e..c586503 100644 --- a/zuul.d/templates.yaml +++ b/zuul.d/templates.yaml @@ -21,7 +21,9 @@ name: test check: jobs: - - check-for-tests + - check-for-tests: + dependencies: + - rpm-scratch-build - rpm-test: dependencies: - check-for-tests