chore(ci): add concurrency control to all workflows#56
Open
Conversation
Why: org-wide CI is queue-bound — 93 jobs perpetually queued across
the org, oldest 23 hours old on spar, ~30-40% of compute spent on
runs against superseded commits. Adding workflow-level concurrency
cancels superseded PR runs (the cheapest, lowest-risk fix) and is a
prerequisite for the runner-migration work tracked separately.
What: a single workflow file in this repo, `.github/workflows/ci.yml`.
Default variant — group by workflow + head_ref (or ref on non-PR
events), cancel-in-progress only on `pull_request` events. The
sbom/provenance jobs in this workflow are gated on
`github.ref == 'refs/heads/main'`; the conditional cancel
(`${{ github.event_name == 'pull_request' }}`) leaves them untouched
on push-to-main while still cancelling stale PR runs.
Classification:
- ci.yml → default variant (filename not in the
release/compliance/sign keyword list; main-only attestation jobs
are protected by the conditional cancel-in-progress).
Out of scope (per the brief): runner migration, job parallelisation,
cache strategy, permissions hardening — tracked separately, depend
on this PR landing first.
Verification:
- YAML parses (python -c "import yaml; yaml.safe_load(...)").
- Diff is 4 lines, only under .github/workflows/.
- After merge, the next PR push will demonstrate cancel behaviour;
main push will demonstrate non-cancellation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tion test) Verifying the concurrency block from the parent commit by pushing two no-op commits in quick succession; the second should cancel this run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test) The previous push's run should be cancelled by this one if the concurrency block is wired correctly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a workflow-level `concurrency:` block to `.github/workflows/ci.yml`. Cancels superseded PR runs; never cancels runs on `main`, tags, or scheduled events. Org-wide pattern landing across 11 repos to clear the queue backlog.
Why
Org has 93 jobs perpetually queued; oldest is 23h old on `spar`. Without concurrency control, every `git push` to a PR branch starts a fresh run while previous runs on superseded commits keep executing. Concurrency control is the cheapest, lowest-risk fix and a strict prerequisite for any later runner migration.
Variant applied
Diff
4-line addition. Strictly scoped to `.github/workflows/` per the brief.
```yaml
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
```
Verification
Out of scope
Runner migration, job parallelisation, cache strategy, permissions hardening — tracked separately, depend on this PR landing first.
🤖 Generated with Claude Code