Skip to content

feat(argocd): make pending-resource list limit configurable for app wait/sync/rollback commands - #29611

Closed
KR-Ravindra wants to merge 1 commit into
argoproj:masterfrom
KR-Ravindra:fix/29031-configurable-pending-resources
Closed

KR-Ravindra wants to merge 1 commit into
argoproj:masterfrom
KR-Ravindra:fix/29031-configurable-pending-resources

Conversation

@KR-Ravindra

Copy link
Copy Markdown
Contributor

Problem

When argocd app wait, argocd app sync, or argocd app rollback commands timeout due to pending resources, the error message displays at most 10 pending resources regardless of how many are actually pending. This limited visibility makes it difficult to diagnose sync issues.

Root Cause

The timeout error handling in waitOnApplicationStatus hard-codes a limit of 10 resources when formatting the error message:

pendingResources := groupResourceStates(app, selectedResources)
pendingResourcesList, _ := formatPendingResources(pendingResources, 10) // hard-coded limit
return fmt.Errorf("timed out waiting for application to sync: %s", pendingResourcesList)

Fix

Add a new --max-pending-resources flag to argocd app wait, sync, and rollback commands with a default value of 10. The flag accepts 0 (show all pending resources) or any positive integer.

Changes:

  1. Added formatPendingResources(resources []*resourceState, maxPending int) error function
  2. Added maxPendingResources parameter to waitOnApplicationStatus signature
  3. Added --max-pending-resources flag to NewApplicationWaitCommand, NewApplicationSyncCommand, and NewApplicationRollbackCommand
  4. Updated all waitOnApplicationStatus call sites to pass the new parameter
  5. Timeout error now uses the configured limit instead of the hard-coded value

How Tested

  • Added comprehensive tests in cmd/argocd/commands/app_pending_test.go covering:
    • Empty resources (nil error returned)
    • One synced resource
    • One pending resource
    • Many pending resources
    • Resources at limit (exactly 10)
    • Resources over limit
    • Limit of 0 (show all)
    • Negative limit (treated as 0)
    • Over 100 resources
    • Large limit (1000)
  • All existing tests pass (go test ./cmd/argocd/commands)
  • Tested that --max-pending-resources 0 displays all resources

Links

This change was prepared with an AI agent operated by KR-Ravindra.

…ait/sync/rollback commands

Add --max-pending-resources flag to argocd app wait, sync, and rollback commands.
The flag controls how many pending resources are displayed in timeout error messages,
replacing the hard-coded limit of 10. Use 0 to show all pending resources.

 Fixes argoproj#29031

Signed-off-by: KR Ravindra <42912207+KR-Ravindra@users.noreply.github.com>
@bunnyshell

bunnyshell Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.57143% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@f363af5). Learn more about missing BASE report.
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
cmd/argocd/commands/app.go 88.57% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #29611   +/-   ##
=========================================
  Coverage          ?   71.51%           
=========================================
  Files             ?      431           
  Lines             ?    55166           
  Branches          ?        0           
=========================================
  Hits              ?    39450           
  Misses            ?    15716           
  Partials          ?        0           
Flag Coverage Δ
e2e 30.61% <0.00%> (?)
unit-tests 67.31% <88.57%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@blakepettersson

Copy link
Copy Markdown
Member

Duplicate of #29601

@blakepettersson blakepettersson marked this as a duplicate of #29601 Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants