Skip to content

Commit 0140433

Browse files
Scope UNSTABLE end-of-run fail to testing stages only
Use a dedicated test_stage_unstable_flag written only by testing-stage rescues (openstack_test, lb via openstack_test, egressip, cpms, csi, conformance). The final ocp_testing play fails only when that flag exists. Soft verification checks and install workarounds keep using stage_unstable_flag without triggering end-of-run failure, preserving their previous job-color behavior. Pair with ci-framework-jobs failure-message: UNSTABLE on monolithic shiftstack jobs for yellow Zuul UI on test failures. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 04c0d2e commit 0140433

10 files changed

Lines changed: 63 additions & 39 deletions

File tree

collection/stages/roles/conformance_test/tasks/run_conformance_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
- name: Mark the openshift tests as UNSTABLE
105105
ansible.builtin.include_role:
106106
name: tools_stage_results
107-
tasks_from: mark_stage_unstable.yml
107+
tasks_from: mark_test_stage_unstable.yml
108108
vars:
109109
unstable_msg: >-
110110
The openshift test Suite failed.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- name: Mark the CPMS {{ cpms_tests_type }} tests as UNSTABLE
2929
ansible.builtin.include_role:
3030
name: tools_stage_results
31-
tasks_from: mark_stage_unstable.yml
31+
tasks_from: mark_test_stage_unstable.yml
3232
vars:
3333
unstable_msg: >-
3434
The {{ cpms_test_name }} {{ cpms_tests_type }} test suite failed.

collection/stages/roles/csi_tests/tasks/run_csi_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- name: Mark the openshift tests as UNSTABLE
2929
ansible.builtin.include_role:
3030
name: tools_stage_results
31-
tasks_from: mark_stage_unstable.yml
31+
tasks_from: mark_test_stage_unstable.yml
3232
vars:
3333
unstable_msg: >-
3434
The openshift test Suite failed.

collection/stages/roles/egressip_tests/tasks/run_egressip_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
- name: Mark the egressip tests as UNSTABLE
9494
ansible.builtin.include_role:
9595
name: tools_stage_results
96-
tasks_from: mark_stage_unstable.yml
96+
tasks_from: mark_test_stage_unstable.yml
9797
vars:
9898
unstable_msg: >-
9999
The EgressIP test suite failed.

collection/stages/roles/openstack_test/tasks/run_openstack_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
- name: Mark the openshift tests as UNSTABLE
208208
ansible.builtin.include_role:
209209
name: tools_stage_results
210-
tasks_from: mark_stage_unstable.yml
210+
tasks_from: mark_test_stage_unstable.yml
211211
vars:
212212
unstable_msg: >-
213213
The openshift test Suite failed.

collection/tools/roles/tools_stage_results/tasks/fail_if_stage_unstable.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
- name: Check whether any testing stage was marked UNSTABLE
3+
ansible.builtin.stat:
4+
path: "{{ test_stage_unstable_flag }}"
5+
register: _test_stage_unstable_flag
6+
7+
- name: Read accumulated UNSTABLE testing stage messages
8+
ansible.builtin.set_fact:
9+
_test_stage_unstable_messages: >-
10+
{{ lookup('ansible.builtin.file', test_stage_unstable_flag)
11+
| split('\n')
12+
| map('trim')
13+
| reject('equalto', '')
14+
| list
15+
| join('; ') }}
16+
when: _test_stage_unstable_flag.stat.exists
17+
18+
- name: Print accumulated UNSTABLE testing stage messages
19+
ansible.builtin.debug:
20+
msg: "{{ _test_stage_unstable_messages }}"
21+
when: _test_stage_unstable_flag.stat.exists
22+
23+
- name: Fail the playbook when any testing stage was marked UNSTABLE
24+
ansible.builtin.fail:
25+
msg: >-
26+
One or more testing stages were marked UNSTABLE:
27+
{{ _test_stage_unstable_messages }}
28+
when: _test_stage_unstable_flag.stat.exists
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Set the test stage unstable var as true
3+
ansible.builtin.set_fact:
4+
test_stage_unstable: true
5+
unstable_warning: "Warning! {{ unstable_msg }}"
6+
7+
- name: Print the test stage UNSTABLE message
8+
ansible.builtin.debug:
9+
msg: "{{ unstable_warning }}"
10+
11+
- name: Mark the test stage result as UNSTABLE
12+
ansible.builtin.lineinfile:
13+
path: "{{ test_stage_unstable_flag }}"
14+
line: "{{ unstable_warning }}"
15+
create: yes
16+
mode: u=rw,g=rw,o=r
17+
delegate_to: localhost

configs/global.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ report_dir: "{{ artifacts_dir }}/test_results"
3232

3333
# Sets the Ansible Controller Node machine's HOME environment variable
3434
controller_home_dir: "{{ lookup('ansible.builtin.env', 'HOME') }}"
35-
# The resources_file and stage_unstable_flag are on the Ansible control node's HOME.
36-
# stage_unstable_flag accumulates UNSTABLE stage messages during the run; ocp_testing.yaml
37-
# fails at the end if the file exists so Zuul/ci-framework see a non-zero exit.
35+
# The resources_file and stage_unstable flags are on the Ansible control node's HOME.
36+
# test_stage_unstable_flag is written only by testing-stage rescues; ocp_testing.yaml
37+
# fails at the end if it exists so Zuul can report UNSTABLE for test failures.
38+
# stage_unstable_flag is used by soft verification/install workarounds (no end-of-run fail).
3839
resources_file: "{{ controller_home_dir }}/artifacts/resources.yml"
3940
stage_unstable_flag: "{{ controller_home_dir }}/artifacts/stage_unstable_flag"
41+
test_stage_unstable_flag: "{{ controller_home_dir }}/artifacts/test_stage_unstable_flag"
4042

4143
admin_cloud: "default"
4244
admin_env_file: "{{ osp_config_dir }}/{{ admin_cloud }}rc"

playbooks/ocp_testing.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
path: "{{ stage_unstable_flag }}"
1111
state: absent
1212

13+
- name: Cleanup workspace flags - Remove the test_stage_unstable_flag if it exists
14+
ansible.builtin.file:
15+
path: "{{ test_stage_unstable_flag }}"
16+
state: absent
17+
1318
- name: Update ocp_deployment_topology with overrides if defined
1419
# Apply ocp_deployment_topology_override on top of the base topology
1520
# The base configuration comes from `configs/global.yml`
@@ -120,13 +125,13 @@
120125
ansible.builtin.import_playbook: plays/egressip_tests.yaml
121126
when: "'egressip_tests' in stages"
122127

123-
- name: Fail if any stage was marked UNSTABLE
128+
- name: Fail if any testing stage was marked UNSTABLE
124129
hosts: localhost
125130
gather_facts: false
126131
vars_files:
127132
- "../configs/global.yml"
128133
tasks:
129-
- name: Check accumulated UNSTABLE stages and fail the playbook
134+
- name: Check accumulated UNSTABLE testing stages and fail the playbook
130135
ansible.builtin.include_role:
131136
name: tools_stage_results
132-
tasks_from: fail_if_stage_unstable.yml
137+
tasks_from: fail_if_test_stage_unstable.yml

0 commit comments

Comments
 (0)