Skip to content

Commit 450de1d

Browse files
fix(ci): fail when jobs are cancelled
This standardizes the last step in many workflows that were only checking for failure and missed the check for cancelled
1 parent a9c4c16 commit 450de1d

File tree

6 files changed

+28
-34
lines changed

6 files changed

+28
-34
lines changed

.github/workflows/ci-integration-review.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
- e2e-tests
162162
if: always() && (startsWith(github.event.review.body, '/ci-run-integration') || contains(github.event.review.body, '/ci-run-all'))
163163
env:
164-
FAILED: ${{ contains(needs.*.result, 'failure') }}
164+
FAILED: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
165165
steps:
166166
- name: Generate authentication token
167167
id: generate_token
@@ -186,10 +186,11 @@ jobs:
186186
token: ${{ secrets.GITHUB_TOKEN }}
187187
status: 'success'
188188

189-
- run: |
190-
echo "failed=${{ env.FAILED }}"
191-
if [[ "$FAILED" == "true" ]] ; then
189+
- name: Check all jobs status
190+
run: |
191+
if [[ "${{ env.FAILED }}" == "true" ]]; then
192+
echo "One or more jobs failed or were cancelled"
192193
exit 1
193194
else
194-
exit 0
195+
echo "All jobs completed successfully"
195196
fi

.github/workflows/e2e.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,12 @@ jobs:
117117
timeout-minutes: 5
118118
if: always()
119119
needs: e2e-tests
120-
env:
121-
FAILED: ${{ contains(needs.*.result, 'failure') }}
122120
steps:
123-
- run: |
124-
echo "failed=${{ env.FAILED }}"
125-
if [[ "$FAILED" == "true" ]] ; then
121+
- name: Check all jobs status
122+
run: |
123+
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
124+
echo "One or more jobs failed or were cancelled"
126125
exit 1
127126
else
128-
exit 0
127+
echo "All jobs completed successfully"
129128
fi

.github/workflows/integration.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,14 @@ jobs:
121121
integration-test-suite:
122122
name: Integration Test Suite
123123
runs-on: ubuntu-24.04
124-
timeout-minutes: 5
125124
if: always()
126125
needs:
127126
- integration-tests
128-
env:
129-
FAILED: ${{ contains(needs.*.result, 'failure') }}
130127
steps:
131128
- run: |
132-
echo "failed=${{ env.FAILED }}"
133-
if [[ "$FAILED" == "true" ]] ; then
129+
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
130+
echo "One or more jobs failed or were cancelled"
134131
exit 1
135132
else
136-
exit 0
133+
echo "All jobs completed successfully"
137134
fi

.github/workflows/k8s_e2e.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ jobs:
245245
- test-e2e-kubernetes
246246
if: always()
247247
env:
248-
FAILED: ${{ contains(needs.*.result, 'failure') }}
248+
FAILED: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
249249
steps:
250250
- name: (PR review) Get PR branch
251251
if: github.event_name == 'pull_request_review' && env.FAILED != 'true'
@@ -260,10 +260,11 @@ jobs:
260260
token: ${{ secrets.GITHUB_TOKEN }}
261261
status: 'success'
262262

263-
- run: |
264-
echo "failed=${{ env.FAILED }}"
265-
if [[ "$FAILED" == "true" ]] ; then
263+
- name: Check all jobs status
264+
run: |
265+
if [[ "${{ env.FAILED }}" == "true" ]]; then
266+
echo "One or more jobs failed or were cancelled"
266267
exit 1
267268
else
268-
exit 0
269+
echo "All jobs completed successfully"
269270
fi

.github/workflows/master_merge_queue.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,12 @@ jobs:
114114
- unit-mac
115115
- unit-windows
116116
- install-sh
117-
env:
118-
FAILED: ${{ contains(needs.*.result, 'failure') }}
119117
steps:
120-
- name: exit
118+
- name: Check all jobs status
121119
run: |
122-
echo "failed=${{ env.FAILED }}"
123-
if [[ "$FAILED" == "true" ]] ; then
120+
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
121+
echo "One or more jobs failed or were cancelled"
124122
exit 1
125123
else
126-
exit 0
124+
echo "All jobs completed successfully"
127125
fi

.github/workflows/regression.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,6 @@ jobs:
544544
- submit-job
545545
- detect-regression
546546
- analyze-experiment
547-
env:
548-
FAILED: ${{ contains(needs.*.result, 'failure') }}
549547
steps:
550548
- name: Download capture-artifacts
551549
continue-on-error: true
@@ -563,11 +561,11 @@ jobs:
563561
echo "Did not find ${REPORT_MD} file."
564562
fi
565563
566-
- name: exit
564+
- name: Check all jobs status
567565
run: |
568-
echo "failed=${{ env.FAILED }}"
569-
if [[ "$FAILED" == "true" ]] ; then
566+
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
567+
echo "One or more jobs failed or were cancelled"
570568
exit 1
571569
else
572-
exit 0
570+
echo "All jobs completed successfully"
573571
fi

0 commit comments

Comments
 (0)