Skip to content

Commit 6589284

Browse files
committed
fix(ci): correctly report offline test results for non-vagrant builds
The shared-steps action runs an offline image test for every non-vagrant build type (oci / gencloud / gencloud_ext4 / opennebula / azure / hyperv): mount the image via qemu-nbd, grep the release string, verify the rpm-reported architecture, and dump the installed packages list. The step is unconditional - it does NOT gate on `inputs.run_test` (per `if: ${{ ! contains(inputs.type, 'vagrant') }}` on the step). Success of that step is recorded as `got_pkgs_list=true`. The summary + Mattermost report, however, were keyed on `inputs.run_test`: 'Tests ${{ inputs.run_test == 'true' && 'passed ✅' || 'N/A ⚠️' }}' so any non-vagrant build dispatched with `run_test=false` falsely reported `Tests N/A ⚠️` even when the offline test actually ran and passed (e.g. https://github.com/AlmaLinux/cloud-images/actions/runs/26090961842). Fix: add a `Compute test status string` step (id: `test_status`) that picks the right label from three env vars - `IS_VAGRANT`, `RUN_TEST`, `GOT_PKGS_LIST` - and exposes it through `$GITHUB_OUTPUT`. Both the github-script summary block and the Mattermost echo now reference `${{ steps.test_status.outputs.test_status }}`, so the label is computed once and used in both places. The five label outcomes: - Non-vagrant + got_pkgs_list=true -> `Tests (offline) passed ✅` - Non-vagrant + got_pkgs_list=false -> `Tests (offline) failed ❌` - Vagrant + run_test=true + got_pkgs_list=true -> `Tests passed ✅` - Vagrant + run_test=true + got_pkgs_list=false -> `Tests failed ❌` - Vagrant + run_test=false -> `Tests N/A ⚠️` `inputs.run_test` no longer affects the non-vagrant branch - the offline test runs regardless, so `got_pkgs_list` is the only signal that matters. The `(offline)` qualifier disambiguates from the real-`vagrant up` smoke test that the vagrant build path runs.
1 parent 7bf7056 commit 6589284

1 file changed

Lines changed: 45 additions & 9 deletions

File tree

.github/actions/shared-steps/action.yml

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,48 @@ runs:
536536
aws s3api put-object-tagging --bucket ${{ inputs.AWS_S3_BUCKET }} --key ${{ env.AWS_S3_PATH }}/${object} --tagging 'TagSet={Key=public,Value=yes}'
537537
done
538538
539+
- name: Compute test status string
540+
id: test_status
541+
shell: bash
542+
env:
543+
IS_VAGRANT: ${{ contains(inputs.type, 'vagrant') && 'true' || 'false' }}
544+
RUN_TEST: ${{ inputs.run_test }}
545+
GOT_PKGS_LIST: ${{ env.got_pkgs_list || 'false' }}
546+
run: |
547+
# Pick the right "Tests ..." label for the workflow summary and the
548+
# Mattermost notification.
549+
#
550+
# Vagrant builds run a real `vagrant up` smoke test inside the build
551+
# runner - that runs only when `inputs.run_test == 'true'`. When it's
552+
# off, there is genuinely no test to report.
553+
#
554+
# All other build types (oci / gencloud / gencloud_ext4 / opennebula
555+
# / azure / hyperv) run the OFFLINE test step earlier in this action
556+
# unconditionally (mount the image via qemu-nbd, grep release + arch
557+
# via rpm --dbpath). `got_pkgs_list=true` means the offline test
558+
# reached the end and produced the packages list - i.e., it passed.
559+
# `got_pkgs_list=false` means it failed somewhere. `inputs.run_test`
560+
# has no bearing on whether the offline test ran.
561+
if [ "${IS_VAGRANT}" = "true" ]; then
562+
if [ "${RUN_TEST}" = "true" ]; then
563+
if [ "${GOT_PKGS_LIST}" = "true" ]; then
564+
status="Tests passed ✅"
565+
else
566+
status="Tests failed ❌"
567+
fi
568+
else
569+
status="Tests N/A ⚠️"
570+
fi
571+
else
572+
if [ "${GOT_PKGS_LIST}" = "true" ]; then
573+
status="Tests (offline) passed ✅"
574+
else
575+
status="Tests (offline) failed ❌"
576+
fi
577+
fi
578+
echo "test_status=${status}" >> "$GITHUB_OUTPUT"
579+
echo "[Debug] Resolved test status: ${status}"
580+
539581
- name: Print workflow summary
540582
uses: actions/github-script@v8
541583
env:
@@ -556,14 +598,8 @@ runs:
556598
summary
557599
.addLink('${{ env.IMAGE_NAME }}.txt', 'https://${{ inputs.AWS_S3_BUCKET }}.s3-accelerate.dualstack.amazonaws.com/${{ env.AWS_S3_PATH }}/${{ env.IMAGE_NAME }}.txt');
558600
}
559-
if (process.env.got_pkgs_list === 'true') {
560-
summary
561-
.addRaw('Tests ${{ inputs.run_test == 'true' && 'passed ✅' || 'N/A ⚠️' }}');
562-
}
563-
if (process.env.got_pkgs_list === 'false') {
564-
summary
565-
.addRaw('Tests ${{ inputs.run_test == 'true' && 'failed ❌' || 'N/A ⚠️' }}');
566-
}
601+
summary
602+
.addRaw('${{ steps.test_status.outputs.test_status }}');
567603
summary.write();
568604
569605
- name: Prepare Mattermost notification message
@@ -584,7 +620,7 @@ runs:
584620
echo "- Image: [${{ env.IMAGE_NAME }}](https://${{ inputs.AWS_S3_BUCKET }}.s3-accelerate.dualstack.amazonaws.com/${{ env.AWS_S3_PATH }}/${{ env.IMAGE_NAME }})"
585621
echo "${{ env.got_pkgs_list == 'true' && format('- Packages list: [{0}.txt](https://{1}.s3-accelerate.dualstack.amazonaws.com/{2}/{3}.txt)', env.IMAGE_NAME, inputs.AWS_S3_BUCKET, env.AWS_S3_PATH, env.IMAGE_NAME) || ''}}"
586622
fi
587-
echo "- Tests ${{ inputs.run_test == 'true' && ( env.got_pkgs_list == 'true' && 'passed ✅' || 'failed ❌' ) || 'N/A ⚠️' }}"
623+
echo "- ${{ steps.test_status.outputs.test_status }}"
588624
589625
echo EOF
590626
} >> "$GITHUB_ENV"

0 commit comments

Comments
 (0)