Repository navigation
CI/CD - Cancel superseded PR runs and skip draft/merge jobs - #906
Conversation
Cancel superseded pull-request workflow runs while allowing active main/release builds to finish updating registry caches and folding queued commits. Skip PR validation on draft pull requests (re-triggering automatically on ready_for_review) across GitHub Actions and Azure Pipelines, and skip the no-op docker-merge jobs on pull requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
CI gating depends on external settings unavailable in the checkout, requiring verification that Azure triggers allow ready-for-review validation and branch protection does not require docker-merge checks now skipped on PRs.
No open issues 🎉
What changed in this PR
This PR reduces unnecessary CI work in GitHub Actions and Azure Pipelines while preserving image definitions, build targets, and required check names.
Changes:
- Adds workflow concurrency to cancel superseded PR runs while allowing active non-PR runs to finish.
- Skips automatic draft PR validation and enables validation when PRs become ready for review.
- Skips image manifest merge jobs on PRs and explicitly configures Azure Pipelines PR cancellation and branch filters.
| File | Description |
|---|---|
.github/workflows/lint.yml |
Adds PR lifecycle triggers, concurrency, and draft guards for lint jobs. |
.github/workflows/gh-pages.yml |
Adds concurrency and draft-aware documentation validation. |
.github/workflows/codeql-analysis.yml |
Adds concurrency and draft guards for both analysis jobs. |
.github/workflows/build-image.yml |
Adds concurrency, skips draft builds, and skips PR manifest merge jobs. |
.azure-pipelines/cuda-unit-test.yml |
Configures automatic PR cancellation, draft exclusion, and target branches. |
.azure-pipelines/cpu-unit-test.yml |
Configures automatic PR cancellation, draft exclusion, and target branches. |
.azure-pipelines/ansible-integration-test.yml |
Configures automatic PR cancellation, draft exclusion, and target branches. |
Review effort: Balanced
Cancel in-progress Build Image runs when a pull request is merged or closed; otherwise non-required jobs such as rocm6.4 keep a self-hosted runner after merge (about 4.75 h on #894). Keep spelling, C++ lint and docs-build running on drafts: they are fast GitHub-hosted required checks, and catching their failures early avoids restarting image builds after ready_for_review. Restore Azure PR validation for every target branch so stacked pull requests keep unit tests, and document the push-run ordering trade-off next to the concurrency block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GitHub processes runs in a concurrency group first-in-first-out by the time each starts waiting and does not guarantee dispatch order, so describe one-at-a-time execution per event and ref instead of promising commit-order image publication. Addresses Copilot review feedback on #906. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The reported draft checks do not cover ready-for-review queuing or close/merge cancellation of active self-hosted image builds, so GitHub event and Azure pipeline trigger behavior still needs live validation.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Use main and release/* as the pull request target branches for the Azure pipelines, matching every GitHub workflow. Shorten the build-image concurrency comment, and drop the explicit event check from the draft and closed job guards: push, release, dispatch and schedule events have no pull request fields, which evaluate to empty strings, so the shorter conditions make the same decisions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Give CodeQL the same pull_request activity types and job guard as the image build, so both workflows that skip drafts also cancel in-progress runs when a pull request is merged or closed. Drop the build-image-only comment so all four concurrency blocks are identical. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Untested PR lifecycle transitions require live GitHub validation to confirm image-build cancellation when all jobs are skipped, isolation from target-branch publishing, and ready-for-review requeuing of Azure required checks.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Reported validation covers only initial drafts, leaving closed/merged build cancellation, protection of main/release publishing, and ready_for_review Azure validation unconfirmed in live CI.
No open issues 🎉
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #906 +/- ##
=======================================
Coverage 86.58% 86.58%
=======================================
Files 107 107
Lines 8419 8419
=======================================
Hits 7290 7290
Misses 1129 1129
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

Description
Reduce avoidable runner contention and wasted CI runs across GitHub Actions and Azure Pipelines without changing any image definitions, build targets, or required check names:
mainandrelease/*runs always finish publishing images and registry build caches.Spelling check,CPP code lintanddocs-buildkeep running on drafts.docker-mergemanifest jobs on pull requests, where image push and manifest creation are already skipped.Major Revision
concurrencyblock to.github/workflows/{build-image,codeql-analysis,gh-pages,lint}.yml. Pull-request runs are grouped per pull request withcancel-in-progress: true. Push, release, schedule and dispatch runs are grouped per event and ref withcancel-in-progress: false: an in-progress run always finishes, a newer run for the same ref waits, and only the latest waiting run is kept. Trade-off: onmain, the next image build starts only after the current run finishes, including its slowest job (rocm6.4has taken about 7.5 h).build-image.ymlandcodeql-analysis.ymlthe samepull_request.types(opened,synchronize,reopened,ready_for_review,converted_to_draft,closed) and the same job guard,!github.event.pull_request.draft && github.event.action != 'closed'. Their jobs skip draft pull requests, and merging or closing a pull request (both arrive asclosed) cancels its in-progress runs; for example,rocm6.4from Benchmarks: Support compact core ranges in CPU STREAM #894 kept a self-hosted runner for about 4.75 h after merge.lint.ymlandgh-pages.ymlkeep the default types and run on drafts.prtriggers to.azure-pipelines/{cpu-unit-test,cuda-unit-test,ansible-integration-test}.ymlwithdrafts: falseandautoCancel: true. PR validation targetsmainandrelease/*, the same branches as the GitHub workflows; pull requests into other branches, such as stacked pull requests into a feature branch, are no longer validated by Azure Pipelines. To validate a draft on demand, mark it ready for review or queue the pipeline manually againstrefs/pull/<N>/merge.Minor Revision
docker-mergein.github/workflows/build-image.ymlwith&& github.event_name != 'pull_request'so pull requests no longer queue four self-hosted Buildx setup/teardown jobs whose merge and push steps are all skipped.Validation
actionlint1.7.12 on the four workflows reports no new findings; its only report (matrix.extra_argsis undefined) is also present onmain.prblocks; verified LF line endings andgit diff --check.github.event_name != 'pull_request' || (...)form. The concurrency group uses the pull request number rather thangithub.ref, so theclosedrun for a merge, whoseGITHUB_REFis the target branch, cannot cancel the build on that branch.6b402e79),Build ImageandCodeQLwere skipped within seconds,Lint(Spelling check,CPP code lint) andGitHub Pages(docs-build) ran and passed, and no Azure Pipelines run was queued. After syncingmain(head8746188a), marking it ready for review started the full image matrix, CodeQL and the Azure unit tests. Theclosedpath is not exercised before merge.