diff --git a/internal/controller/promotion/argocd.go b/internal/controller/promotion/argocd.go index c87038b61..d8c0cc37f 100644 --- a/internal/controller/promotion/argocd.go +++ b/internal/controller/promotion/argocd.go @@ -220,17 +220,12 @@ func (a *argoCDMechanism) mustPerformUpdate( // The operation has completed. Check if the desired revision was applied. desiredRevision := libargocd.GetDesiredRevision(app, newFreight) - if desiredRevision == "" { - // We cannot determine the desired revision. Performing an update in this - // case wouldn't change anything. Instead, we should error out. - return "", false, errors.New("unable to determine desired revision") - } if status.SyncResult == nil { // We do not have a sync result, so we cannot determine if the operation // was successful. The best recourse is to retry the operation. return "", true, errors.New("operation completed without a sync result") } - if status.SyncResult.Revision != desiredRevision { + if desiredRevision != "" && status.SyncResult.Revision != desiredRevision { // The operation did not result in the desired revision being applied. // We should attempt to retry the operation. return "", true, fmt.Errorf( diff --git a/internal/controller/promotion/argocd_test.go b/internal/controller/promotion/argocd_test.go index 426bf97ea..73b3c403f 100644 --- a/internal/controller/promotion/argocd_test.go +++ b/internal/controller/promotion/argocd_test.go @@ -519,11 +519,12 @@ func TestArgoCDMustPerformUpdate(t *testing.T) { Username: applicationOperationInitiator, }, }, + SyncResult: &argocd.SyncOperationResult{}, } }, assertions: func(t *testing.T, phase argocd.OperationPhase, mustUpdate bool, err error) { - require.ErrorContains(t, err, "unable to determine desired revision") - require.Empty(t, phase) + require.NoError(t, err) + require.Equal(t, argocd.OperationSucceeded, phase) require.False(t, mustUpdate) }, },