Skip to content

Commit 210de45

Browse files
committed
fix(gencloud-test): use steps.run_tests.outcome instead of job.status
job.status does not reflect failures of steps inside the same composite action - the parent job's status only flips after the composite returns, so inside the composite an if: always() follow-up step sees job.status == "success" even when an earlier composite step failed. The job summary and Mattermost message therefore would report "Test: passed" for runs whose test step had actually failed. Tag the "Run image tests" step with id: run_tests and have the summary / Mattermost steps read steps.run_tests.outcome instead. When an earlier composite step fails (install, KVM probe, etc.) run_tests is skipped and its outcome is "skipped" - correctly treated as "not success" by the if/ternary.
1 parent 1c397c1 commit 210de45

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/actions/gencloud-test-steps/action.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ runs:
179179
done
180180
181181
- name: Run image tests
182+
id: run_tests
182183
shell: bash
183184
env:
184185
ALMA_ARCH: ${{ inputs.alma_arch }}
@@ -292,7 +293,13 @@ runs:
292293
IMAGE_FILENAME: ${{ inputs.image_filename }}
293294
IMAGE_URL: ${{ inputs.image_url }}
294295
SUBTYPE: ${{ inputs.subtype }}
295-
JOB_STATUS: ${{ job.status }}
296+
# job.status doesn't reflect failures of steps inside the same
297+
# composite action (the parent job's status flips only after this
298+
# composite returns) - so read the test step's own outcome.
299+
# When a step BEFORE run_tests fails (install, KVM probe, ...),
300+
# run_tests is skipped and its outcome is "skipped", which is
301+
# correctly treated as "not success" below.
302+
TESTS_OUTCOME: ${{ steps.run_tests.outcome }}
296303
run: |
297304
# Job summary
298305
{
@@ -308,7 +315,7 @@ runs:
308315
if [ -n "${SYSTEM_ARCH:-}" ]; then
309316
echo "- **System architecture**: \`${SYSTEM_ARCH}\`"
310317
fi
311-
if [ "${JOB_STATUS}" = "success" ]; then
318+
if [ "${TESTS_OUTCOME}" = "success" ]; then
312319
echo "- **Test**: passed ✅"
313320
else
314321
echo "- **Test**: failed ❌"
@@ -346,4 +353,4 @@ runs:
346353
${{ inputs.subtype == 'gencloud_ext4' && '**Subtype**: `gencloud_ext4` (ext4 root)' || '' }}
347354
${{ env.ALMA_RELEASE && format('**AlmaLinux release**: `{0}`', env.ALMA_RELEASE) || '' }}
348355
${{ env.SYSTEM_ARCH && format('**System architecture**: `{0}`', env.SYSTEM_ARCH) || '' }}
349-
**Test**: ${{ job.status == 'success' && 'passed ✅' || 'failed ❌' }}
356+
**Test**: ${{ steps.run_tests.outcome == 'success' && 'passed ✅' || 'failed ❌' }}

0 commit comments

Comments
 (0)