Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0ede781
feat: abort ongoing operation when a new revision is available
aslafy-z May 7, 2025
cda7c15
feat(cli): add --sync-retry-refresh flag
aslafy-z May 25, 2024
1c28858
docs: add sync retry refresh feature to auto-sync docs
aslafy-z May 7, 2025
9be2b9a
chore: generate files
olivergondza Aug 15, 2025
b744b36
feat(ui): Show retry.refresh in application details page
olivergondza May 5, 2025
2fc1fc4
fix(sync): Fix Sync Refresh handling and tests
olivergondza Jul 17, 2025
0f38809
chore: Update lint warnings
olivergondza May 19, 2025
1f99b00
feat(auto-sync): Abort current sync and start a new one after failure…
olivergondza Jul 16, 2025
cd38799
feat(auto-sync): Pick new commits on opt-in bases
olivergondza Jul 17, 2025
23d3a25
feat(auto-sync): Abort current sync and start a new one after failure…
olivergondza Jul 23, 2025
d84b5d7
chore(e2e): Remove now unused RevertCommit
olivergondza Jul 23, 2025
6d6d352
chore: Use data driven test
olivergondza Jul 23, 2025
d6c97ea
chore: Reorder imports to please linters
olivergondza Jul 23, 2025
547dfac
Merge branch 'master' into issue-11494
agaudreault Aug 21, 2025
a551294
fix merge
agaudreault Aug 21, 2025
f447e30
cleanup
agaudreault Aug 21, 2025
1a67754
docs
agaudreault Aug 22, 2025
9b7932f
Merge remote-tracking branch 'olivergondza/issue-11494' into issue-11…
agaudreault Sep 10, 2025
d29f69a
codegen
agaudreault Sep 10, 2025
dd5fb7b
docs
agaudreault Sep 10, 2025
3723462
tests
agaudreault Sep 10, 2025
73a7c2e
cli
agaudreault Sep 10, 2025
f5c640d
e2e
agaudreault Sep 10, 2025
252b160
codegen
agaudreault Sep 10, 2025
6e3f208
Merge remote-tracking branch 'olivergondza/issue-11494' into issue-11…
agaudreault Sep 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
command := &cobra.Command{
Use: "get APPNAME",
Short: "Get application details",
Example: templates.Examples(`
Example: templates.Examples(`
# Get basic details about the application "my-app" in wide format
argocd app get my-app -o wide

Expand Down Expand Up @@ -383,7 +383,7 @@ func NewApplicationGetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com

# Get application details and display them in a tree format
argocd app get my-app --output tree

# Get application details and display them in a detailed tree format
argocd app get my-app --output tree=detailed
`),
Expand Down Expand Up @@ -541,7 +541,7 @@ func NewApplicationLogsCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
command := &cobra.Command{
Use: "logs APPNAME",
Short: "Get logs of application pods",
Example: templates.Examples(`
Example: templates.Examples(`
# Get logs of pods associated with the application "my-app"
argocd app logs my-app

Expand Down Expand Up @@ -855,7 +855,7 @@ func NewApplicationSetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com
command := &cobra.Command{
Use: "set APPNAME",
Short: "Set application parameters",
Example: templates.Examples(`
Example: templates.Examples(`
# Set application parameters for the application "my-app"
argocd app set my-app --parameter key1=value1 --parameter key2=value2

Expand Down Expand Up @@ -2085,6 +2085,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
applyOutOfSyncOnly bool
async bool
retryLimit int64
retryRefresh bool
retryBackoffDuration time.Duration
retryBackoffMaxDuration time.Duration
retryBackoffFactor int64
Expand Down Expand Up @@ -2356,9 +2357,10 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
default:
log.Fatalf("Unknown sync strategy: '%s'", strategy)
}
if retryLimit > 0 {
if retryLimit != 0 {
syncReq.RetryStrategy = &argoappv1.RetryStrategy{
Limit: retryLimit,
Limit: retryLimit,
Refresh: retryRefresh,
Backoff: &argoappv1.Backoff{
Duration: retryBackoffDuration.String(),
MaxDuration: retryBackoffMaxDuration.String(),
Expand Down Expand Up @@ -2427,6 +2429,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
command.Flags().StringArrayVar(&labels, "label", []string{}, "Sync only specific resources with a label. This option may be specified repeatedly.")
command.Flags().UintVar(&timeout, "timeout", defaultCheckTimeoutSeconds, "Time out after this many seconds")
command.Flags().Int64Var(&retryLimit, "retry-limit", 0, "Max number of allowed sync retries")
command.Flags().BoolVar(&retryRefresh, "retry-refresh", false, "Indicates if the latest revision should be used on retry instead of the initial one")
command.Flags().DurationVar(&retryBackoffDuration, "retry-backoff-duration", argoappv1.DefaultSyncRetryDuration, "Retry backoff base duration. Input needs to be a duration (e.g. 2m, 1h)")
command.Flags().DurationVar(&retryBackoffMaxDuration, "retry-backoff-max-duration", argoappv1.DefaultSyncRetryMaxDuration, "Max retry backoff duration. Input needs to be a duration (e.g. 2m, 1h)")
command.Flags().Int64Var(&retryBackoffFactor, "retry-backoff-factor", argoappv1.DefaultSyncRetryFactor, "Factor multiplies the base duration after each failed retry")
Expand Down Expand Up @@ -3484,7 +3487,7 @@ func NewApplicationRemoveSourceCommand(clientOpts *argocdclient.ClientOptions) *
Short: "Remove a source from multiple sources application.",
Example: ` # Remove the source at position 1 from application's sources. Counting starts at 1.
argocd app remove-source myapplication --source-position 1

# Remove the source named "test" from application's sources.
argocd app remove-source myapplication --source-name test`,
Run: func(c *cobra.Command, args []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/util/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func AddAppFlags(command *cobra.Command, opts *AppOptions) {
command.Flags().DurationVar(&opts.retryBackoffDuration, "sync-retry-backoff-duration", argoappv1.DefaultSyncRetryDuration, "Sync retry backoff base duration. Input needs to be a duration (e.g. 2m, 1h)")
command.Flags().DurationVar(&opts.retryBackoffMaxDuration, "sync-retry-backoff-max-duration", argoappv1.DefaultSyncRetryMaxDuration, "Max sync retry backoff duration. Input needs to be a duration (e.g. 2m, 1h)")
command.Flags().Int64Var(&opts.retryBackoffFactor, "sync-retry-backoff-factor", argoappv1.DefaultSyncRetryFactor, "Factor multiplies the base duration after each failed sync retry")
command.Flags().BoolVar(&opts.retryRefresh, "sync-retry-refresh", false, "Set if a new revision should trigger a new sync")
command.Flags().BoolVar(&opts.retryRefresh, "sync-retry-refresh", false, "Indicates if the latest revision should be used on retry instead of the initial one")
command.Flags().StringVar(&opts.ref, "ref", "", "Ref is reference to another source within sources field")
command.Flags().StringVar(&opts.SourceName, "source-name", "", "Name of the source from the list of sources of the app.")
}
Comment on lines 169 to 175

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation of retry logic lacks validation for the duration and factor values. It's important to ensure that these values are within a reasonable range to prevent potential issues such as excessively long retry intervals or overly aggressive retry escalation, which could impact application performance and resource usage.

Recommendation: Implement validation checks for retryBackoffDuration, retryBackoffMaxDuration, and retryBackoffFactor to ensure they fall within expected limits. This could be done by adding a check after the flags are parsed or by using a custom flag parsing function that includes validation logic.

Expand Down
20 changes: 11 additions & 9 deletions controller/appcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1424,23 +1424,21 @@ func (ctrl *ApplicationController) processRequestedAppOperation(app *appv1.Appli
return
}

// Remove the desired revisions if the sync failed and we are retrying. The latest revision from the source will be used.
extraMsg := ""
if state.Operation.Retry.Refresh {
if app.Operation != nil && app.Operation.InitiatedBy.Automated {
logCtx.Infof("Refreshing the retry")
state.Operation.Sync.Revision = ""
state.Operation.Sync.Revisions = nil
} else {
logCtx.Infof("Not refreshing the retry during manual sync")
}
extraMsg += " with latest revisions"
state.Operation.Sync.Revision = ""
state.Operation.Sync.Revisions = nil
}

// Get rid of sync results and null out previous operation completion time
// This will start the retry attempt
state.Message = fmt.Sprintf("Retrying operation. Attempt #%d", state.RetryCount)
state.Message = fmt.Sprintf("Retrying operation%s. Attempt #%d", extraMsg, state.RetryCount)
state.FinishedAt = nil
state.SyncResult = nil
ctrl.setOperationState(app, state)
logCtx.Infof("Retrying operation. Attempt #%d", state.RetryCount)
logCtx.Infof("Retrying operation%s. Attempt #%d", extraMsg, state.RetryCount)
default:
logCtx.Infof("Resuming in-progress operation. phase: %s, message: %s", state.Phase, state.Message)
}
Expand Down Expand Up @@ -2139,16 +2137,20 @@ func (ctrl *ApplicationController) autoSync(app *appv1.Application, syncStatus *
}
}

source := ptr.To(app.Spec.GetSource())
desiredRevisions := []string{syncStatus.Revision}
if app.Spec.HasMultipleSources() {
source = nil
desiredRevisions = syncStatus.Revisions
}

op := appv1.Operation{
Sync: &appv1.SyncOperation{
Source: source,
Revision: syncStatus.Revision,
Prune: app.Spec.SyncPolicy.Automated.Prune,
SyncOptions: app.Spec.SyncPolicy.SyncOptions,
Sources: app.Spec.Sources,
Revisions: syncStatus.Revisions,
},
InitiatedBy: appv1.OperationInitiator{Automated: true},
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_admin_app_generate-spec.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_add-source.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_create.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_remove-source.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/user-guide/commands/argocd_app_set.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_app_sync.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions manifests/core-install-with-hydrator.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions manifests/core-install.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions manifests/crds/application-crd.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions manifests/ha/install-with-hydrator.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading