From b9eddcda7767ee75324f00569dca0f825c7eac6c Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mar 21 2022 09:14:33 +0000 Subject: [PATCH 1/2] Fix to match requirements of STI spec (tests/tests*.yml) This patch fixes an issue where only tests/tests.yml was checked for embeded STI tests. This also removes the useless usage of ansible_user_dir. --- diff --git a/playbooks/rpm/check-for-sti-tests.yaml b/playbooks/rpm/check-for-sti-tests.yaml index 2cef899..6f0e675 100644 --- a/playbooks/rpm/check-for-sti-tests.yaml +++ b/playbooks/rpm/check-for-sti-tests.yaml @@ -1,18 +1,20 @@ --- - hosts: localhost tasks: - - name: Check for tests/tests.yml exists - stat: - path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/tests.yml" + - name: Check for tests/tests*.yml exists + shell: "find tests/tests*.yml" + failed_when: false register: tests_stat + args: + chdir: "{{ zuul.project.src_dir }}" - zuul_return: data: zuul: child_jobs: - rpm-sti-test - when: tests_stat.stat.exists + when: tests_stat.stdout_lines - zuul_return: data: zuul: child_jobs: [] - when: not tests_stat.stat.exists + when: not tests_stat.stdout_lines diff --git a/playbooks/rpm/check-for-tests.yaml b/playbooks/rpm/check-for-tests.yaml index 4544467..af51e11 100644 --- a/playbooks/rpm/check-for-tests.yaml +++ b/playbooks/rpm/check-for-tests.yaml @@ -1,18 +1,20 @@ --- - hosts: localhost tasks: - - name: Check for tests/tests.yml exists - stat: - path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/tests.yml" + - name: Check for tests/tests*.yml exists + shell: "find tests/tests*.yml" + failed_when: false register: tests_stat + args: + chdir: "{{ zuul.project.src_dir }}" - zuul_return: data: zuul: child_jobs: - rpm-test - when: tests_stat.stat.exists + when: tests_stat.stdout_lines - zuul_return: data: zuul: child_jobs: [] - when: not tests_stat.stat.exists + when: not tests_stat.stdout_lines From b5062dc61815deaabf4f399e9c1de3acdae37843 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mar 21 2022 10:46:06 +0000 Subject: [PATCH 2/2] Remove useless use of find and rely on return code --- diff --git a/playbooks/rpm/check-for-sti-tests.yaml b/playbooks/rpm/check-for-sti-tests.yaml index 6f0e675..8431245 100644 --- a/playbooks/rpm/check-for-sti-tests.yaml +++ b/playbooks/rpm/check-for-sti-tests.yaml @@ -2,7 +2,7 @@ - hosts: localhost tasks: - name: Check for tests/tests*.yml exists - shell: "find tests/tests*.yml" + shell: "ls tests/tests*.yml" failed_when: false register: tests_stat args: @@ -12,9 +12,9 @@ zuul: child_jobs: - rpm-sti-test - when: tests_stat.stdout_lines + when: tests_stat.rc == 0 - zuul_return: data: zuul: child_jobs: [] - when: not tests_stat.stdout_lines + when: not tests_stat.rc == 0 diff --git a/playbooks/rpm/check-for-tests.yaml b/playbooks/rpm/check-for-tests.yaml index af51e11..06cd78b 100644 --- a/playbooks/rpm/check-for-tests.yaml +++ b/playbooks/rpm/check-for-tests.yaml @@ -2,7 +2,7 @@ - hosts: localhost tasks: - name: Check for tests/tests*.yml exists - shell: "find tests/tests*.yml" + shell: "ls tests/tests*.yml" failed_when: false register: tests_stat args: @@ -12,9 +12,9 @@ zuul: child_jobs: - rpm-test - when: tests_stat.stdout_lines + when: tests_stat.rc == 0 - zuul_return: data: zuul: child_jobs: [] - when: not tests_stat.stdout_lines + when: not tests_stat.rc == 0