@@ -101,6 +101,8 @@ jobs:
101101
102102 # Run e2e tests
103103 e2e :
104+ outputs :
105+ status : ${{ steps.status.outputs.status }}
104106 needs : [ "token", "find-tf-releases", "list-examples" ]
105107 runs-on : k8s-large
106108 environment : default
@@ -178,23 +180,16 @@ jobs:
178180 azure_tenant_id : ${{ secrets.AZURE_TENANT_ID }}
179181 azure_subscription_id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
180182
181- - name : Save status
182- if : always()
183+ - name : Mark error
184+ id : status
185+ if : failure()
183186 run : |
184- JOB_ID="${{ matrix.test.name }}"
185- STATUS=$([[ "${{ job.status }}" == "success" ]] && echo "pass" || echo "fail")
186- mkdir -p status
187- echo "$JOB_ID:$STATUS" > status/$JOB_ID.txt
188- echo "Saved: $JOB_ID = $STATUS"
189-
190- - name : Upload status
191- if : always()
192- uses : actions/upload-artifact@v4
193- with :
194- name : status-${{ matrix.test.name }}
195- path : status/
187+ echo "status=failure" >> "${GITHUB_OUTPUT}"
188+ exit 1
196189
197190 upgrade :
191+ outputs :
192+ status : ${{ steps.status.outputs.status }}
198193 needs : [ "token", "find-tf-releases", "list-examples" ]
199194 runs-on : k8s-large
200195 environment : default
@@ -274,56 +269,20 @@ jobs:
274269 azure_tenant_id : ${{ secrets.AZURE_TENANT_ID }}
275270 azure_subscription_id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
276271
277- - name : Save status
278- if : always()
279- run : |
280- JOB_ID="${{ matrix.test.name }}"
281- STATUS=$([[ "${{ job.status }}" == "success" ]] && echo "pass" || echo "fail")
282- mkdir -p status
283- echo "$JOB_ID:$STATUS" > status/$JOB_ID.txt
284- echo "Saved: $JOB_ID = $STATUS"
285-
286- - name : Upload status
272+ - name : Mark error
287273 id : status
288- if : always()
289- uses : actions/upload-artifact@v4
290- with :
291- name : status-${{ matrix.test.name }}
292- path : status/
274+ if : failure()
275+ run : |
276+ echo "status=failure" >> "${GITHUB_OUTPUT}"
277+ exit 1
293278
294279 report :
295280 runs-on : k8s-nano
296281 needs : [ "e2e", "upgrade" ]
297- # if: ${{ github.ref_name == 'main' }}
282+ if : ${{ github.ref_name == 'main' && (needs.e2e.outputs.status == 'failure' || needs.upgrade.outputs.status == 'failure') }}
298283 steps :
299- - name : Download all statuses
300- uses : actions/download-artifact@v4
301- with :
302- pattern : status-*
303- path : all-status/
304- merge-multiple : true
305-
306- - name : Check results
307- run : |
308- echo "=== Tests Results ==="
309- FAILED_COUNT=0
310- for file in all-status/*.txt; do
311- if [ -f "$file" ]; then
312- RESULT=$(cat "$file")
313- echo " $RESULT"
314- [[ "$RESULT" == *":fail" ]] && ((FAILED_COUNT++))
315- fi
316- done
317- echo ""
318- if [ $FAILED_COUNT -eq 0 ]; then
319- echo "🟢 OK"
320- echo "status=SUCCESS" >> $GITHUB_OUTPUT
321- else
322- echo "🔴 FAILED"
323- echo "status=FAILED" >> $GITHUB_OUTPUT
324- fi
325284 - name : Report Failure on slack
326- if : ${{ github.ref_name == 'main' && steps.report .outputs.status == 'FAILED' }}
285+ if : ${{ github.ref_name == 'main' && (needs.e2e .outputs.status == 'failure' || needs.upgrade.outputs.status == 'failure') }}
327286 uses : ravsamhq/notify-slack-action@v2
328287 with :
329288 token : ${{ secrets.GITHUB_TOKEN }}
@@ -336,7 +295,7 @@ jobs:
336295 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK }}
337296 - name : Report error on github UI
338297 run : |
339- if [ "${{ steps.report .outputs.status }}" == 'FAILED ' ]
298+ if [ "${{ needs.e2e .outputs.status }}" == 'failure' || needs.upgrade.outputs.status == 'failure ' ]
340299 then
341300 exit 1
342301 fi
0 commit comments