feat(dev-ci): assign createdAt RG tag policy to e2e subs (AROSLSRE-1543) - #6182
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a declarative dev-ci mechanism to ensure DEV e2e/customer subscriptions have the Azure Policy needed to stamp tags['createdAt'] on newly created resource groups, enabling cleanup-sweeper rg-ordered to discover and delete eligible RGs.
Changes:
- Added subscription fan-out Bicep templates to deploy a subscription-scoped Policy Definition + Assignment to each
.ci.dev.e2eSubscriptionssubscription. - Wired the new template into the privileged
e2e-subscription-rbac-grantsdev-ci pipeline as a new ARM step. - Updated cleanup documentation to describe the declarative path (while keeping the imperative script for one-off/non-dev use).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ci/cleanup.md | Documents that DEV e2e/customer subs get the createdAt RG tag policy via privileged dev-ci (and when to use the imperative script). |
| dev-infrastructure/templates/createdat-rg-tag-policy.bicep | Subscription-scope fan-out template that targets each e2e/customer subscription. |
| dev-infrastructure/templates/createdat-rg-tag-policy-subscription.bicep | Per-subscription policy definition + assignment; reuses the existing JSON rule via loadJsonContent. |
| dev-infrastructure/dev-ci/e2e-subscription-rbac-grants/pipeline.yaml | Adds the createdat-rg-tag-policy privileged pipeline step using the new templates/config. |
| dev-infrastructure/configurations/createdat-rg-tag-policy.tmpl.bicepparam | Supplies .ci.dev.e2eSubscriptions IDs to the fan-out template, mirroring the existing RBAC grants idiom. |
|
/test e2e-parallel Retesting: environmental flake unrelated to this PR's diff (dev-ci bicep policy + docs; no component image or e2e-path change). Job This is the SWIFT v2 / AKS container DNS cold-start readiness timeout (AROSLSRE-1465/1469), an environment-provisioning issue in CI, not caused by the diff here. Re-running. |
1fcc644 to
7c4caa9
Compare
|
Force-pushed No behavior change. Verified the dev-ci render path ( |
cleanup-sweeper rg-ordered discovery treats the createdAt resource-group tag as required for any delete rule, but Azure never stamps it and the e2e/customer subscriptions had no policy applying it. Those subscriptions were therefore invisible to rg-ordered, letting orphaned resource groups and Key Vaults accumulate. Assign the createdAt append policy declaratively to the DEV e2e subscriptions (.ci.dev.e2eSubscriptions) via a subscription-scoped bicep fan-out, mirroring e2e-subscription-rbac-assignments.bicep and reusing the existing rg-createdat-policy-rule.json as the single source of truth. Wire it as the createdat-rg-tag-policy step in the privileged dev-ci e2e-subscription-rbac-grants pipeline, since writing policy definitions/assignments needs Microsoft.Authorization/policy*/write that the unattended Contributor bot lacks.
7c4caa9 to
c59a089
Compare
|
/lgtm |
The rule body is duplicated between rg-createdat-policy-rule.json (imperative script) and createdat-rg-tag-policy-subscription.bicep (declarative dev-ci path). Document the drift risk so both are kept in sync.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: raelga, roivaz, weherdh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Jira: AROSLSRE-1543 (parent story AROSLSRE-1542)
What
Assigns the
createdAtresource-group tag Azure Policy to the DEV e2e/customer subscriptions (.ci.dev.e2eSubscriptions) declaratively via dev-ci:dev-infrastructure/templates/createdat-rg-tag-policy.bicepfans a subscription-scoped policy definition + assignment out to each e2e subscription, mirroringe2e-subscription-rbac-assignments.bicep.tags['createdAt']=[utcNow()]when missing). It intentionally does notloadJsonContentacross the tree intotooling/; the rule is kept textually in sync with the imperativecreate-createdat-policy-assignment.sh/rg-createdat-policy-rule.json, and both use the same policy definition/assignment names (aro-rg-createdat-tag/aro-createdat-rg) so they converge on one definition.createdat-rg-tag-policystep in the privilegede2e-subscription-rbac-grantspipeline.docs/ci/cleanup.mdupdated to document the new dev-ci path.Why
cleanup-sweeperrg-ordereddiscovery treats thecreatedAttag as required for anyaction: deleterule (tooling/cleanup-sweeper/pkg/policy/discovery.go). Azure never stamps that tag by default, and the e2e/customer subscriptions had no policy applying it. As a result those subscriptions were effectively invisible torg-ordered, letting orphaned resource groups and soft-deleted Key Vaults accumulate (root cause behind theVaultAlreadyExistsINT e2e flakes and the leaked-RG backlog).The policy step lives in the privileged dev-ci tree because writing policy definitions/assignments needs
Microsoft.Authorization/policy*/write, which the unattended Contributor bot deliberately lacks.Testing
bicep build+bicep lint+bicep formatclean on both new templates.templatize pipeline validateparses the modified pipeline schema successfully (the pre-existing range-loop bicepparam field-access warning is shared with the siblinge2e-subscription-rbac-assignments.tmpl.bicepparamand is not introduced here).make dev-ci-privileged-local-runas an OWNERS member.Special notes for your reviewer
.ci.dev.e2eSubscriptions: EA, EA2, Dev-02, Dev-03). INT/STG/PROD e2e subscriptions are ARM-integrated and tracked as follow-ups under the parent story (AROSLSRE-1544/AROSLSRE-1545/AROSLSRE-1546).PR Checklist