Skip to content

Commit b29770d

Browse files
Use ansible.builtin.stat for remote JUnit file check instead of Jinja2 is file
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ff531a2 commit b29770d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

collection/stages/roles/cpms_test/tasks/run_cpms_test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,18 @@
3939
vars:
4040
must_gather_suffix: "cpms-{{ cpms_tests_type }}"
4141

42+
- name: Check if JUnit file exists
43+
ansible.builtin.stat:
44+
path: "{{ cpms_results_subdir }}/{{ cpms_test_junit_filename }}"
45+
register: _cpms_junit_file
46+
4247
- name: Rename JUnit XML to match expected prefix
4348
ansible.builtin.copy:
4449
src: "{{ cpms_results_subdir }}/{{ cpms_test_junit_filename }}"
4550
dest: "{{ cpms_results_subdir }}/junit_e2e_{{ cpms_tests_type }}.xml"
4651
remote_src: yes
4752
mode: u=rw,g=rw,o=r
48-
when: (cpms_results_subdir + '/' + cpms_test_junit_filename) is file
53+
when: _cpms_junit_file.stat.exists
4954

5055
- name: Post openshift-test
5156
ansible.builtin.include_role:
@@ -56,4 +61,4 @@
5661
key_for_filtering_results: "cpms"
5762
test_name: "{{ cpms_test_name }}-{{ cpms_tests_type }}"
5863
results_dir: "{{ cpms_results_subdir }}"
59-
when: (cpms_results_subdir + '/' + cpms_test_junit_filename) is file
64+
when: _cpms_junit_file.stat.exists

0 commit comments

Comments
 (0)