Skip to content

fix(cli): support multiple --header flags in ARGOCD_OPTS env var#27768

Open
superShen0916 wants to merge 1 commit intoargoproj:masterfrom
superShen0916:fix/argocd-opts-multi-header
Open

fix(cli): support multiple --header flags in ARGOCD_OPTS env var#27768
superShen0916 wants to merge 1 commit intoargoproj:masterfrom
superShen0916:fix/argocd-opts-multi-header

Conversation

@superShen0916
Copy link
Copy Markdown

@superShen0916 superShen0916 commented May 9, 2026

Checklist:

  • (b) this is a bug fix
  • The title of the PR states what changed and the related issues number
  • The title of the PR conforms to the PR title guidelines: fix(cli): support multiple --header flags in ARGOCD_OPTS env var
  • I've included "Fixes ARGOCD_OPTS does not accept --header parameter multiple times #24065" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them. (N/A - CLI-only bug fix)
  • Does this PR require documentation updates? No
  • I have signed off all my commits as required by DCO
  • I have written unit tests for my change
  • My build is green
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Why this PR is necessary

ARGOCD_OPTS environment variable does not support multiple --header flags, unlike the CLI. This inconsistency means users who rely on ARGOCD_OPTS (e.g., in CI/CD pipelines or shared environments) cannot set multiple headers without using a comma-separated workaround.

What this PR solves

Fixes #24065. Changes flags storage from map[string]string to map[string][]string to support repeated string slice flags (like --header) in ARGOCD_OPTS. The fix is backwards compatible with existing comma-separated values and all other flag types (bool, int, string).

Changes

  • util/config/env.go: Changed flags to map[string][]string, updated LoadFlags/GetFlag/GetIntFlag/GetStringSliceFlag
  • util/config/env_test.go: Added 4 new test cases for multi-value flags

Test plan

  • All 24 existing tests pass
  • 4 new tests: multi-value --header, mixed with bool flags, backwards-compatible CSV, single value

@superShen0916 superShen0916 requested a review from a team as a code owner May 9, 2026 18:26
@bunnyshell
Copy link
Copy Markdown

bunnyshell Bot commented May 9, 2026

✅ Preview Environment deployed on Bunnyshell

Component Endpoints
argocd https://argocd-lea3ah.bunnyenv.com/
argocd-ttyd https://argocd-web-cli-lea3ah.bunnyenv.com/

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🔴 /bns:stop to stop the environment
  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.94%. Comparing base (5ec0603) to head (f95d6a9).

Files with missing lines Patch % Lines
util/config/env.go 80.00% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27768      +/-   ##
==========================================
- Coverage   63.96%   63.94%   -0.02%     
==========================================
  Files         421      421              
  Lines       57774    57775       +1     
==========================================
- Hits        36954    36944      -10     
- Misses      17339    17351      +12     
+ Partials     3481     3480       -1     

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

Change flags storage from map[string]string to map[string][]string
to support repeated flags (e.g. --header) in ARGOCD_OPTS, matching
the behavior when passed directly on the CLI.

Closes argoproj#24065

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: shenpeng.sp0916 <shenpeng.sp0916@bytedance.com>
@superShen0916 superShen0916 force-pushed the fix/argocd-opts-multi-header branch from f95d6a9 to 944e62a Compare May 10, 2026 06:07
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.

ARGOCD_OPTS does not accept --header parameter multiple times

1 participant