@@ -41,14 +41,17 @@ jobs:
4141 should_run : ${{ steps.check.outputs.has_label }}
4242 steps :
4343 - id : check
44+ env :
45+ PR_FORK : ${{ github.event.pull_request.head.repo.fork }}
46+ HAS_LABEL : ${{ contains(github.event.pull_request.labels.*.name, 'ready for testing') }}
4447 run : |
4548 # Fork PRs never receive secrets or id-token permissions, so the
4649 # integration tests cannot run even if the label is added. Maintainers
4750 # must push the branch to this repo to run them.
48- if [[ "${{ github.event.pull_request.head.repo.fork }} " == "true" ]]; then
51+ if [[ "$PR_FORK " == "true" ]]; then
4952 echo "Fork PR - integration tests cannot run (no access to secrets)."
5053 echo "has_label=false" >> $GITHUB_OUTPUT
51- elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'ready for testing') }} " == "true" ]]; then
54+ elif [[ "$HAS_LABEL " == "true" ]]; then
5255 echo "has_label=true" >> $GITHUB_OUTPUT
5356 else
5457 echo "has_label=false" >> $GITHUB_OUTPUT
@@ -88,11 +91,16 @@ jobs:
8891 echo "CWA_GITHUB_TEST_REPO_BRANCH=${CWA_GITHUB_TEST_REPO_BRANCH:-${{ env.CWA_GITHUB_TEST_REPO_BRANCH }}}" >> "$GITHUB_OUTPUT"
8992
9093 - name : Echo test variables
94+ env :
95+ GITHUB_SHA_VAL : ${{ github.sha }}
96+ OUT_REPO_NAME : ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }}
97+ OUT_REPO_URL : ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }}
98+ OUT_REPO_BRANCH : ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }}
9199 run : |
92- echo "build_id: ${{ github.sha }} "
93- echo "CWA_GITHUB_TEST_REPO_NAME: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_NAME }} "
94- echo "CWA_GITHUB_TEST_REPO_URL: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_URL }} "
95- echo "CWA_GITHUB_TEST_REPO_BRANCH: ${{ steps.set-outputs.outputs.CWA_GITHUB_TEST_REPO_BRANCH }} "
100+ echo "build_id: $GITHUB_SHA_VAL "
101+ echo "CWA_GITHUB_TEST_REPO_NAME: $OUT_REPO_NAME "
102+ echo "CWA_GITHUB_TEST_REPO_URL: $OUT_REPO_URL "
103+ echo "CWA_GITHUB_TEST_REPO_BRANCH: $OUT_REPO_BRANCH "
96104
97105 - uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
98106 with :
@@ -169,9 +177,12 @@ jobs:
169177 run : |
170178 # GitHub Actions matrix limit is 256 jobs per workflow run.
171179 # Use 200 per page for headroom. Up to 5 pages supported (1000 tests).
172- # The ec2_linux_matrix is @json-encoded (double-encoded), so decode first.
180+ # Read the filtered matrix from the file written by the "Generate matrix"
181+ # step instead of a step-level env var: the matrix can exceed the
182+ # kernel's ARG_MAX (~2 MiB) on execve, which would prevent bash from
183+ # starting for this step.
173184 PAGE_SIZE=200
174- FULL_MATRIX=$(echo '${{ steps.set-matrix.outputs.ec2_linux_matrix }}' | jq -r '.' )
185+ FULL_MATRIX=$(cat filtered_matrix.json )
175186 TOTAL=$(echo "$FULL_MATRIX" | jq 'length')
176187 PAGE_COUNT=$(( (TOTAL + PAGE_SIZE - 1) / PAGE_SIZE ))
177188
@@ -190,9 +201,12 @@ jobs:
190201 done
191202
192203 - name : Echo test plan matrix
204+ env :
205+ EC2_LINUX_PAGE_COUNT : ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_page_count }}
206+ EC2_SELINUX_MATRIX : ${{ steps.set-matrix.outputs.ec2_selinux_matrix }}
193207 run : |
194- echo "ec2_linux_matrix pages: ${{ steps.paginate-matrix.outputs.ec2_linux_matrix_page_count }} "
195- echo "ec2_selinux_matrix: ${{ steps.set-matrix.outputs.ec2_selinux_matrix }} "
208+ echo "ec2_linux_matrix pages: $EC2_LINUX_PAGE_COUNT "
209+ echo "ec2_selinux_matrix: $EC2_SELINUX_MATRIX "
196210
197211
198212 EC2LinuxIntegrationTest-0 :
@@ -355,23 +369,28 @@ jobs:
355369 runs-on : ubuntu-latest
356370 steps :
357371 - name : Check for ready for testing label
372+ env :
373+ PR_FORK : ${{ github.event.pull_request.head.repo.fork }}
374+ PR_DRAFT : ${{ github.event.pull_request.draft }}
375+ HAS_SKIP_TESTING : ${{ contains(github.event.pull_request.labels.*.name, 'skip testing') }}
376+ HAS_READY_FOR_TESTING : ${{ contains(github.event.pull_request.labels.*.name, 'ready for testing') }}
358377 run : |
359- if [[ "${{ github.event.pull_request.head.repo.fork }} " == "true" ]]; then
378+ if [[ "$PR_FORK " == "true" ]]; then
360379 echo "Fork PR - integration tests skipped (no access to secrets). Push branch to this repo to run them."
361380 exit 0
362381 fi
363382
364- if [[ "${{ github.event.pull_request.draft }} " == "true" ]]; then
383+ if [[ "$PR_DRAFT " == "true" ]]; then
365384 echo "Draft PR - skipping label check."
366385 exit 0
367386 fi
368387
369- if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip testing') }} " == "true" ]]; then
388+ if [[ "$HAS_SKIP_TESTING " == "true" ]]; then
370389 echo "'skip testing' label found - bypassing integration test requirement."
371390 exit 0
372391 fi
373392
374- if [[ "${{ contains(github.event.pull_request.labels.*.name, 'ready for testing') }} " != "true" ]]; then
393+ if [[ "$HAS_READY_FOR_TESTING " != "true" ]]; then
375394 echo "Missing 'ready for testing' label. Please add before merging."
376395 exit 1
377396 fi
@@ -388,16 +407,15 @@ jobs:
388407 if : always()
389408 steps :
390409 - name : Check Job Status
410+ env :
411+ NEEDS_JSON : ${{ toJSON(needs) }}
391412 run : |
392- # Convert needs context to JSON and process with jq
393- needs_json='${{ toJSON(needs) }}'
394-
395413 failed_jobs=()
396414 successful_jobs=()
397415
398416 # Loop through all jobs in needs context
399- for job in $(echo "$needs_json " | jq -r 'keys[]'); do
400- result=$(echo "$needs_json " | jq -r ".[\"$job\"].result")
417+ for job in $(echo "$NEEDS_JSON " | jq -r 'keys[]'); do
418+ result=$(echo "$NEEDS_JSON " | jq -r ".[\"$job\"].result")
401419
402420 if [[ "$result" == "failure" ]]; then
403421 failed_jobs+=("$job")
0 commit comments