Skip to content

ARGOCD_OPTS does not accept --header parameter multiple times #24065

@erikvanbrakel

Description

@erikvanbrakel

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

The ⁠argocd CLI accepts the ⁠--header option multiple times when passed directly on the command line. However, when using the ⁠ARGOCD_OPTS environment variable, only a single ⁠--header is recognized. To pass multiple headers via ⁠ARGOCD_OPTS, they must be comma-separated within a single ⁠--header option, which is inconsistent with the CLI behavior.

To Reproduce

Run ⁠argocd with multiple ⁠--header options directly:

argocd app list --header "CF-Access-Client-Id: foo" --header "CF-Access-Client-Secret: bar"

Both headers are sent.

Set ⁠ARGOCD_OPTS with multiple ⁠--header options:

export ARGOCD_OPTS='--header "CF-Access-Client-Id: foo" --header "CF-Access-Client-Secret: bar"'
argocd app list

Only the one header is sent I think, in any case it does not work properly.

Set ⁠ARGOCD_OPTS with a single comma-separated ⁠--header:

export ARGOCD_OPTS='--header "CF-Access-Client-Id: foo, CF-Access-Client-Secret: bar"'
argocd app list

Works as expected.

Expected behavior
setting ARGOCD_OPTS should work identically to setting the CLI options.

Version

  BuildDate: 2025-05-29T18:05:04Z
  GitCommit: af9ebac0bb35dc16eb034c1cefaf7c92d1029927
  GitTreeState: clean
  GoVersion: go1.24.1
  Compiler: gc
  Platform: linux/arm64

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcomponent:cliIssue related to the Argo CD CLIgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions