fix(ci): restrict staging ECR cleanup to cudly-staging repos#1235
fix(ci): restrict staging ECR cleanup to cudly-staging repos#1235cristim wants to merge 1 commit into
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Warning Review limit reached
More reviews will be available in 1 minute and 18 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
The staging cleanup workflow force-deleted any ECR repository named exactly 'cudly', which is also the default production repository name in rollback.yml. Drop the legacy '== cudly' clause from the JMESPath filter (the one-off pre-suffix teardown it served is done) and add an in-loop guard that refuses to delete any repository not matching the cudly-staging* naming pattern, so a future filter change cannot widen the blast radius silently. Also remove the stale 'cudly' fallback for vars.ECR_REPOSITORY in rollback.yml: the validate job now fails loudly when the variable is unset instead of guessing a repository name that diverges from the suffixed cudly-prod-<hex> Terraform naming scheme. Validated with actionlint and a shell simulation of the guard (bare 'cudly' and cudly-prod-* refused, cudly-staging* deleted). Closes #1185
|
@coderabbitai review |
✅ Action performedReview finished.
|
Adversarial review (PR #1235)Reviewed against the brief's risk surfaces (filter correctness, sibling-cleanup parity, no-staging-match behavior, dry-run, immediate-vs-deferred delete, base-branch + migration hygiene). The two-file change is sound, INF-05's blast-radius bug is closed, and the defense-in-depth guard is correct. One in-scope-adjacent hardening gap on the rollback side filed as a follow-up. Verified
Follow-up filed (out of scope here)
UNSTABLE stateThe three failing checks on this PR are all pre-existing on
None reachable from a workflow-only diff. Not blocking. VerdictLGTM. CR re-ping posted ( |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Tip For best results, initiate chat on the files or code changes.
Your verification around the Terraform-driven naming contract, the duplicated AWS-side guardrails, and the fail-loud rollback behavior adds strong confidence that the scoped cleanup is now doing the right thing. Also noted on (ᵔᴥᵔ)ノ🐇 ✏️ Learnings added
|
Problem
Code review finding INF-05 (P3): the staging cleanup workflow's ECR delete loop matched
starts_with(repositoryName,'cudly-staging') || repositoryName=='cudly'and then ranaws ecr delete-repository --force. The barecudlyname is exactly the default production repository used by rollback.yml (${{ vars.ECR_REPOSITORY || 'cudly' }}), leaving a hardcoded prod-adjacent name inside a force-delete loop. The== 'cudly'clause was a one-off for the legacy pre-suffix repo and has served its purpose; the rollback default is stale relative to the suffixedcudly-prod-<hex>Terraform naming scheme.Fix
.github/workflows/cleanup-staging.yml(both AWS jobs): drop therepositoryName=='cudly'clause so onlycudly-staging*repos are queried, and add an in-loopcaseguard that refuses (exit 1) any repository name not matching the staging pattern, so a future filter change cannot silently widen the blast radius..github/workflows/rollback.yml: remove the silent|| 'cudly'fallback forvars.ECR_REPOSITORY. The validate job now fails the rollback loudly when the variable is unset instead of guessing a repo name, and the verify-image step double-checks it.Test evidence
actionlintpasses on both edited workflows.cudlyandcudly-prod-ab12are REFUSED,cudly-stagingandcudly-staging-ab12are deleted.cudlyrepo; post-fix it is excluded by the query and rejected by the guard.Closes #1185