Add concurrency groups to repo-based deploy/delete workflows - #12850
Add concurrency groups to repo-based deploy/delete workflows#12850pujitha24 wants to merge 5 commits into
Conversation
Motivation: The four repo-based deploy/delete reusable workflow templates
(run-rad-commands-aws.yml, run-rad-commands-azure.yml, delete-aws.yml,
delete-azure.yml) each restore Radius control-plane state with
`rad startup` and persist it again with `rad shutdown`, against a single
durable state archive per environment (an OCI package, or the
radius-state git orphan branch). None of them declared a `concurrency:`
group, so two overlapping runs targeting the same environment could race
on that shared archive: one run's `rad shutdown` could overwrite state
another run just restored, or two runs could push conflicting snapshots
and corrupt it.
Approach: Add a `concurrency:` block to each of the four workflow files,
keyed by `radius-state-archive-${{ inputs.environment }}`. The key
deliberately omits `github.workflow` so a deploy and a delete against the
same environment also serialize against each other, since both share the
same archive; keying only by workflow name would still leave that pair
racing. `cancel-in-progress` is left false so a queued run waits its turn
instead of a newer run cancelling one that is already mid-flight, which
would abandon it before `rad shutdown` can persist its state.
Report: radius-project#12848
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-sonnet-5 (via Claude Code)
There was a problem hiding this comment.
Pull request overview
This PR adds a workflow-level concurrency group to the four repo-based reusable deploy/delete workflow templates so runs targeting the same GitHub Environment are serialized, preventing races while restoring/persisting the shared Radius state archive (rad startup / rad shutdown).
Changes:
- Add
concurrency.group: radius-state-archive-${{ inputs.environment }}to serialize deploy/delete runs per Environment. - Set
cancel-in-progress: falseso queued runs wait rather than canceling an in-flight run (avoids skippingrad shutdownpersistence). - Apply the same concurrency policy consistently across AWS/Azure deploy and delete templates.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/extension/run-rad-commands-aws.yml | Adds environment-keyed concurrency to serialize state-archive access for AWS deploy runs. |
| .github/extension/run-rad-commands-azure.yml | Adds environment-keyed concurrency to serialize state-archive access for Azure deploy runs. |
| .github/extension/delete-aws.yml | Adds environment-keyed concurrency to serialize state-archive access for AWS delete runs. |
| .github/extension/delete-azure.yml | Adds environment-keyed concurrency to serialize state-archive access for Azure delete runs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
While checking on this I noticed #12719 merged into main and removed |
|
Hi @pujitha24, thanks for the contribution. We have changed our workflow setup so this PR will require some updates. I will respond here again once we have more info on how to update the PR. Thank you for your patience! |
Summary
Add a
concurrency:group to the four repo-based deploy/delete reusableworkflow templates (
run-rad-commands-aws.yml,run-rad-commands-azure.yml,delete-aws.yml,delete-azure.yml) so runs against the same GitHubEnvironment are serialized instead of racing on the shared state archive.
Reason for change
These four workflows each restore Radius control-plane state with
rad startupand persist it again withrad shutdown, against a singledurable state archive per environment (an OCI package or the
radius-stategit orphan branch). None of them declared a
concurrency:group, so twooverlapping runs targeting the same environment — e.g. two deploys, or a
deploy and a delete — could race on that archive: one run's
rad shutdownoverwriting state another run just restored, or two runs pushing conflicting
snapshots and corrupting it.
The added group key intentionally omits
github.workflowso that a deployand a delete against the same environment also serialize against each other,
since both touch the same archive; keying only by the workflow name would
still leave that pair racing.
cancel-in-progressis leftfalseso aqueued run waits its turn instead of a newer run cancelling one that is
already mid-flight, which would abandon it before
rad shutdowncan persistits state.
Fixes #
How to test
These are reusable-workflow (
workflow_call) YAML templates that Radiuscopies into a user's repository; they have no Go unit-test target. Validated
statically:
actionlint .github/extension/{run-rad-commands-aws,run-rad-commands-azure,delete-aws,delete-azure}.yml— no new findings. The one pre-existing shellcheck
SC1090warning in thetwo
run-rad-commands-*files is unrelated to this change and reproducesidentically on
main(confirmed viagit stash).python3 -c "import yaml; yaml.safe_load(open(f).read())"for all fourfiles — parses cleanly, including the new
concurrencyblock.top-level workflows (
concurrency:immediately afterpermissions:andbefore
env:/jobs:, as inbuild.yaml/unit-tests.yaml/functional-test-cloud.yaml).Not run: an actual overlapping-run reproduction against a live GitHub
Actions runner and real state archive, which isn't reproducible locally.
GitHub Actions' documented behavior is that a
concurrency:group declaredinside a reusable
workflow_callworkflow is honored for that workflow'sown job(s), and in this repo's case these four files are copied verbatim
into the user's
.github/workflows/and invoked via a localuses: ./...path (per
.github/extension/README.md), which is the simplest, wellsupported form of this feature.
File change summary
.github/extension/run-rad-commands-aws.ymlconcurrency:group keyed by environment,cancel-in-progress: false..github/extension/run-rad-commands-azure.ymlconcurrency:group keyed by environment,cancel-in-progress: false..github/extension/delete-aws.ymlconcurrency:group keyed by environment,cancel-in-progress: false..github/extension/delete-azure.ymlconcurrency:group keyed by environment,cancel-in-progress: false.Fixes #12848