Skip to content

fix: remove revision==1 gate for scaleDown onsuccess. Fixes #4681#4730

Open
SimbaKingjoe wants to merge 1 commit into
argoproj:masterfrom
SimbaKingjoe:fix/scale-down-revision-check
Open

fix: remove revision==1 gate for scaleDown onsuccess. Fixes #4681#4730
SimbaKingjoe wants to merge 1 commit into
argoproj:masterfrom
SimbaKingjoe:fix/scale-down-revision-check

Conversation

@SimbaKingjoe
Copy link
Copy Markdown

Summary

Remove the revision == 1 gate from promoteStable() so workloadRef.scaleDown: onsuccess triggers on every stable promotion, not just the initial deploy.

Background

When using BlueGreen strategy with workloadRef.scaleDown: onsuccess, the referenced Deployment should be scaled down every time a new ReplicaSet is promoted to stable. However, the check in promoteStable() (rollout/sync.go:1040) included revision == 1, restricting the scale-down to only the very first deployment.

For revision >= 2, shouldFullPromote() correctly runs PostPromotionAnalysis (if configured), returns "Completed blue-green update", and calls promoteStable(), but the scale-down is silently skipped because revision != 1.

Modifications

  • rollout/sync.go: Remove revision == 1 && from the scaleDown condition in promoteStable()
  • rollout/sync_test.go: Add TestScaleDownDeploymentOnSuccessRevision2 verifying scale-down triggers on revision 2

Verification

go test ./rollout/ -run 'TestScaleDownDeploymentOnSuccess' -v
# PASS: TestScaleDownDeploymentOnSuccess (revision 1)
# PASS: TestScaleDownDeploymentOnSuccessRevision2 (revision 2)

Checklist:

  • This is a bug fix
  • The title follows conventional commits: fix: remove revision==1 gate for scaleDown onsuccess
  • DCO sign-off included
  • Unit tests written and passing
  • My organization is added to USERS.md (N/A - bug fix)

The revision==1 check in promoteStable prevented workloadRef.scaleDown
from triggering on any revision beyond the first. This means for
BlueGreen + scaleDown: onsuccess, the referenced Deployment was only
scaled down on the initial deploy and never again.

Remove the revision gate so scaleDown fires on every stable promotion.

Fixes argoproj#4681

Signed-off-by: Joe <simba@kingjoe.com>
Signed-off-by: daixin1204 <daixin1204@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
55.0% Duplication on New Code (required ≤ 40%)

See analysis details on SonarQube Cloud

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.07%. Comparing base (2ccdae8) to head (21efebe).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4730      +/-   ##
==========================================
+ Coverage   85.03%   85.07%   +0.03%     
==========================================
  Files         164      164              
  Lines       18989    18989              
==========================================
+ Hits        16148    16154       +6     
+ Misses       1993     1990       -3     
+ Partials      848      845       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

Published E2E Test Results

  4 files    4 suites   3h 46m 30s ⏱️
120 tests 107 ✅  7 💤  6 ❌
490 runs  452 ✅ 28 💤 10 ❌

For more details on these failures, see this check.

Results for commit 21efebe.

@github-actions
Copy link
Copy Markdown
Contributor

Published Unit Test Results

2 470 tests   2 470 ✅  3m 22s ⏱️
  129 suites      0 💤
    1 files        0 ❌

Results for commit 21efebe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant