shahar1 commented on code in PR #75578:
URL: https://github.com/apache/airflow/pull/75578#discussion_r4368326754


##########
.github/workflows/ci-amd.yml:
##########
@@ -1508,12 +1515,18 @@ jobs:
       - tests-with-lowest-direct-resolution-providers
     runs-on: ["ubuntu-slim"]
     steps:
-      - name: "Fail if any CI job failed or was cancelled"
-        if: contains(needs.*.result, 'failure') || contains(needs.*.result, 
'cancelled')
+      - name: "Fail if any CI job failed"
+        if: contains(needs.*.result, 'failure')
         run: |
-          echo "At least one CI job failed or was cancelled."
+          echo "At least one CI job failed."
           exit 1
+      - name: "Report that CI jobs were cancelled"
+        if: contains(needs.*.result, 'cancelled')

Review Comment:
   **minor** — a job that hits `timeout-minutes` is cancelled by GitHub, so its 
`needs.<job>.result` is `cancelled`, not `failure` (unless I am misremembering 
how Actions reports job timeouts). With this change, a run where a test job 
hangs past `job-timeout-minutes: 80` and nothing else fails now reports a green 
**CI passed (run cancelled)** instead of a red **CI passed**.
   
   On PRs the merge stays blocked, so nothing unsafe merges; the PR just shows 
no red check. On the scheduled canary it is a bigger change: `notify-slack` 
collects `select(.conclusion == "failure")` job names, and the timed-out job 
reports `cancelled`, so with **CI passed** no longer failing a hung canary run 
no longer posts to Slack. The same applies to `ci-arm.yml`.
   
   One way to keep the duplicate-run fix and still flag timeouts: a timeout 
cancels a job but not the workflow, so `cancelled()` stays false. Failing this 
step when the workflow itself was not cancelled would keep the check red for 
timeouts, for example:
   
   ```yaml
         - name: "Fail if a CI job was cancelled without the run being 
cancelled"
           if: contains(needs.*.result, 'cancelled') && !cancelled()
           run: |
             echo "A CI job was cancelled (likely a timeout) while the run was 
not."
             exit 1
   ```
   
   The job would still carry the **(run cancelled)** name in that case, which 
is a slightly misleading label, but the red check and the Slack alert come back.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to