mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
fix: address golangci-lint errors
Signed-off-by: liketosweep <liketosweep@gmail.com>
This commit is contained in:
parent
64038d4a8f
commit
d94865d170
3 changed files with 11 additions and 8 deletions
|
|
@ -1475,11 +1475,11 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli
|
|||
logCtx.Debug("Finished processing requested app operation")
|
||||
}()
|
||||
|
||||
//added the 'ctrl.hydrator != nil' check and changed Background() to 'ctx'
|
||||
// added the 'ctrl.hydrator != nil' check and changed Background() to 'ctx'
|
||||
if ctrl.hydrator != nil && app.Spec.SourceHydrator != nil && app.Operation != nil && app.Operation.Sync != nil {
|
||||
revision := app.Operation.Sync.Revision
|
||||
err := ctrl.hydrator.RollbackApp(context.Background(), app, revision)
|
||||
if err != nil {
|
||||
if err != nil {
|
||||
ctrl.setOperationState(app, &appv1.OperationState{
|
||||
Phase: synccommon.OperationFailed,
|
||||
Message: err.Error(),
|
||||
|
|
@ -1488,7 +1488,7 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli
|
|||
}
|
||||
ctrl.setOperationState(app, &appv1.OperationState{
|
||||
Phase: synccommon.OperationSucceeded,
|
||||
Message: fmt.Sprintf("rolled back to %s", revision),
|
||||
Message: "rolled back to " + revision,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
|
||||
"context"
|
||||
|
||||
appv1 "github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
|
||||
)
|
||||
|
||||
func (ctrl *ApplicationController) RollbackApp(ctx context.Context, app *appv1.Application, hydratedRevision string) error {
|
||||
return ctrl.hydrator.RollbackApp(ctx, app, hydratedRevision)
|
||||
return ctrl.hydrator.RollbackApp(ctx, app, hydratedRevision)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -661,7 +661,9 @@ func (h *Hydrator) RollbackApp(ctx context.Context, app *appv1.Application, hydr
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to commit rollback: %w", err)
|
||||
}
|
||||
|
||||
h.dependencies.RequestAppRefresh(app.Name, app.Namespace)
|
||||
// We assign the result to 'err' and check it
|
||||
if err := h.dependencies.RequestAppRefresh(app.Name, app.Namespace); err != nil {
|
||||
return fmt.Errorf("failed to request app refresh: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue