Skip to content

Commit

Permalink
fix(promotion): wait for open pull request
Browse files Browse the repository at this point in the history
This addresses the immediate issue, by ensuring the Phase of the
Promotion is set to Running for as long as a pull request is open.

However, I do feel this is the result of us not taking a defensive
approach when composing the Phase the Promotion is in, by assuming
a Promotion to be Successful (in multiple places) until we are told
it isn't.

The less error prone approach would be to assume the opposite, but
this is arguably much more difficult to achieve.

Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Aug 21, 2024
1 parent 7aa7889 commit 7aaf673
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/controller/promotion/pullrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ func reconcilePullRequest(
if err != nil {
return "", err
}
if !pr.IsOpen() {
if pr.IsOpen() {
promo.Status.Phase = kargoapi.PromotionPhaseRunning
} else {

Check warning on line 168 in internal/controller/promotion/pullrequest.go

View check run for this annotation

Codecov / codecov/patch

internal/controller/promotion/pullrequest.go#L166-L168

Added lines #L166 - L168 were not covered by tests
merged, err := gpClient.IsPullRequestMerged(ctx, prNumber)
if err != nil {
return "", err
Expand Down

0 comments on commit 7aaf673

Please sign in to comment.