fix: git commit status not reflecting in promotion strategy#1110
fix: git commit status not reflecting in promotion strategy#1110
Conversation
|
Commit status controllers are supposed to require either the PS or CTP (I forget which) after state transitions. This is documented in best practices. Maybe the git controller isnt doing that correctly. Work in a test drive way. Start with a test that tries to reproduce the issue with just a git status. If that doesn't reproduce the issue, use an argocd health check too, like in the issue. A failing test that fails for the right reason is better than nothing. But try to also find the fix. |
|
@copilot see last comment |
|
@copilot try again |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1110 +/- ##
==========================================
+ Coverage 50.41% 50.56% +0.14%
==========================================
Files 51 51
Lines 5492 5496 +4
==========================================
+ Hits 2769 2779 +10
+ Misses 2417 2415 -2
+ Partials 306 302 -4 ☔ View full report in Codecov by Sentry. |
…stays success Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
Addressed in d453183. Root cause: Fix: Extended the condition to also trigger CTP enqueue when the phase is success AND the proposed SHA changed. This makes the GCS controller directly enqueue the CTP for any meaningful state change rather than relying solely on the CommitStatus controller's SHA-based lookup path as a fallback. Test: Added |
When a
GitCommitStatusevaluates to success for a new proposed SHA (without a phase transition from non-success), the correspondingChangeTransferPolicyis not re-enqueued directly by the GCS controller.Root Cause
GitCommitStatus controller — missing CTP enqueue on SHA-only transitions
touchChangeTransferPoliciesonly fires when phase transitions from non-success → success:When a new proposed SHA arrives and the expression still evaluates to success (no phase change),
transitionedEnvironmentsstays empty and the CTP is never directly enqueued. TheCommitStatuscontroller's SHA-based fallback path can miss the CTP if it hasn't yet reconciled for the new SHA at the time the fallback runs.Changes
gitcommitstatus_controller.go: ExtendtransitionedEnvironmentsto also capture environments where the proposed SHA changed while the phase remains success, sotouchChangeTransferPoliciesreliably enqueues the CTP after any meaningful state change.gitcommitstatus_controller_test.go: Add integration test"GitCommitStatus SHA-only transition enqueues CTP"— two environments withAutoMerge=trueand a GitCommitStatus withexpression: "true"— that verifies both CTPs auto-merge for a first commit and again for a second commit (the SHA-only transition case).Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.