argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
18.06k stars 5.52k forks source link

CLI: argocd app get fails on application with multiple sources #20670

Closed mrobinson513 closed 3 weeks ago

mrobinson513 commented 3 weeks ago

Checklist:

Describe the bug

When using argocd CLI tool v2.13.0 to make calls to an ArgoCD server running 2.12.x, the cli returns the following error:

zsh 1458 [1] % argocd app get app-staging --grpc-web

FATA[0001] Source position should be specified and must be greater than 0 for applications with multiple sources

To Reproduce

Deploy an Application with multiple sources. In our case, the Application is generated using ApplicationSet templating.

Note: some data in the config files has been deliberately withheld due to company security policies, but this should be enough to reproduce.

applicationset.yaml

---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: charts-from-git-configs
  namespace: argocd
spec:
  goTemplate: true
  generators:
  - git:
      repoURL: git@github.com:REDACTED/kube-manifests.git
      revision: main
      files:
      - path: "configs/REDACTED/config.yaml"
  template:
    metadata:
      name: "{{.name}}"
    spec:
      info:
        - name: commit
          value: '{{default "none-provided" .commit}}'
      project: default
      sources:
      - repoURL: "{{.repoURL}}"
        chart: '{{default "" .chart}}'
        targetRevision: "{{.targetRevision}}"
        helm:
          valueFiles:
          - "$values/{{.path.path}}/values.yaml"
          - "$values/{{.path.path}}/values-image.yaml"
          ignoreMissingValueFiles: true
          values: |-
            {{default "" .values}}
      - repoURL: 'git@github.com:REDACTED/manifests.git'
        targetRevision: main
        ref: values
      destination:
        server: https://kubernetes.default.svc
        namespace: "{{.namespace}}"

application.yaml

name: app-staging
namespace: app-staging
chart: helm-app
repoURL: REDACTED.dkr.ecr.us-east-1.amazonaws.com
targetRevision: 6.13.1
values:
 REDACTED
  1. Download/install argocd v.2.13.0
  2. Authenticate the cli to an instance running v2.12.x
  3. Run argocd app get app-name (--grpc-web can be included if needed but does not make a difference)

Expected behavior

argocd app get output should resemble:

Name:               argocd/app-staging
Project:            default
Server:             https://kubernetes.default.svc
Namespace:          app-staging
URL:                https://REDACTED/applications/app-staging
Sources:
- Repo:             REDACTED.dkr.ecr.us-east-1.amazonaws.com
  Target:           6.13.1
  Helm Values:      $values/configs/REDACTED/app-staging/values.yaml,$values/configs/REDACTED/app-staging/values-image.yaml
- Repo:             git@github.com:REDACTED/kube-manifests.git
  Target:           main
  Ref:              values
SyncWindow:         Sync Allowed
Sync Policy:        Automated
Sync Status:        Synced to 6.13.1
Health Status:      Healthy

GROUP                  KIND                 NAMESPACE             NAME                                    STATUS     HEALTH   HOOK     MESSAGE
                       Namespace                                  app-staging                    Succeeded  Synced            namespace/app-staging serverside-applied
external-secrets.io    SecretStore          app-staging  app-eso-secret-store           Succeeded           PreSync  store validated
                       ConfigMap            app-staging  app-db-ready-script-configmap  Succeeded           PreSync  app-db-ready-script-configmap created
external-secrets.io    ExternalSecret       app-staging  app-ejson-key                  Succeeded           PreSync  Secret was synced
external-secrets.io    ExternalSecret       app-staging  app-env                        Succeeded           PreSync  Secret was synced
batch                  Job                  app-staging  app-migration                  Succeeded           PreSync  job.batch/app-migration created
policy                 PodDisruptionBudget  app-staging  app-pdb                        Synced                       poddisruptionbudget.policy/app-pdb configured
                       Service              app-staging  app-web                        Synced     Healthy           service/app-web unchanged
                       Service              app-staging  app-worker                     Synced     Healthy           service/app-worker unchanged
apps                   Deployment           app-staging  app-worker-low-priority        Synced     Healthy           deployment.apps/app-worker-low-priority configured
apps                   Deployment           app-staging  app-worker-medium-priority     Synced     Healthy           deployment.apps/app-worker-medium-priority configured
apps                   Deployment           app-staging  app-worker-high-priority       Synced     Healthy           deployment.apps/app-worker-high-priority configured
apps                   Deployment           app-staging  app                            Synced     Healthy           deployment.apps/app configured
networking.k8s.io      Ingress              app-staging  app                            Synced     Healthy           ingress.networking.k8s.io/app unchanged

Version

argocd: v2.13.0+347f221
  BuildDate: 2024-11-04T12:29:51Z
  GitCommit: 347f221adba5599ef4d5f12ee572b2c17d01db4d
  GitTreeState: clean
  GoVersion: go1.22.8
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.12.4+27d1e64
  BuildDate: 2024-09-26T06:36:13Z
  GitCommit: 27d1e641b6ea99d9f4bf788c032aeaeefd782910
  GitTreeState: clean
  GoVersion: go1.22.4
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.4.2 2024-05-22T15:19:38Z
  Helm Version: v3.15.2+g1a500d5
  Kubectl Version: v0.29.6
  Jsonnet Version: v0.20.0