argoproj / argo-cd

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

`argocd app sync` not working with `--label` option in multi-source apps #19709

Open dapama opened 3 weeks ago

dapama commented 3 weeks ago

Bug description

I am trying to synchronize an application filtering resources by a specific label, using ArgoCD CLI:

argocd app sync <app-name> --label 'test=test'

The application is a multi-source one (the --label option is working perfect for single source apps):

  sources:
    - repoURL: 'https://github.com/*/helm-chart-template.git'
      targetRevision: v2.0.0
      path: .
      helm:
        releaseName: app-name
        version: v3
        valueFiles:
          - $values/staging/values-stg.yaml
          - $values/staging/ns/values-stg.yaml
          - $values/staging/ns/values-stg-tag.yaml
          - $values/staging/ns/values-stg-cm.yaml
    - repoURL: 'https://github.com/*/helm-chart-app-name-values.git'
      targetRevision: staging
      ref: values

But I am getting the following error:

FATA[0000] rpc error: code = Unknown desc = Manifest generation error (cached): `helm template . --name-template <app-name> --namespace ns --kube-version 1.29 --values <path to cached source>/staging/values-stg.yaml --values <path to cached source>/staging/ns/values-stg.yaml --values <path to cached source>/staging/ns/values-stg-tag.yaml --values <path to cached source>/staging/ns/values-stg-cm.yaml <api versions removed> --include-crds` failed exit status 1: Error: open <path to cached source>/staging/values-stg.yaml: no such file or directory 

Version

argocd: v2.10.9+c071af8
  BuildDate: 2024-04-30T16:39:16Z
  GitCommit: c071af808170bfc39cbdf6b9be4d0212dd66db0c
  GitTreeState: clean
  GoVersion: go1.21.9
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.10.9+c071af8
  BuildDate: 2024-04-30T15:53:28Z
  GitCommit: c071af808170bfc39cbdf6b9be4d0212dd66db0c
  GitTreeState: clean
  GoVersion: go1.21.3
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v5.2.1 2023-10-19T20:13:51Z
  Helm Version: v3.14.3+gf03cc04
  Kubectl Version: v0.26.11
  Jsonnet Version: v0.20.0
eugene70 commented 2 weeks ago

It seems there might be a connection to issue #18129.

kingbj940429 commented 2 weeks ago

can I solve this bug?

nitishfy commented 1 week ago

Hi @kingbj940429 , are you working on this?

If no, I'd like to take this up :)

kingbj940429 commented 1 week ago

Hi @nitishfy

sorry, I'm working on

nitishfy commented 2 days ago

Hey @kingbj940429 , are there any updates?

kingbj940429 commented 15 hours ago

@nitishfy

I'm so busy thesedays...

so could you solve this?

I'm sorry

nitishfy commented 8 hours ago

Thanks, I'll take this up.

nitishfy commented 5 hours ago

@dapama I tried to reproduce this bug locally but seems like everything is working well for me. This is my application manifest

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: helm-guestbook-multisource
  namespace: argocd
spec:
  project: default
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
  destination:
    server: https://kubernetes.default.svc
    namespace: helm-guestbook-multisource
  sources:
    - repoURL: https://github.com/nitishfy/argocd-example-apps
      path: helm-guestbook
      targetRevision: master
      helm:
        valueFiles:
          - $values/dev-values.yaml
    - repoURL: 'https://github.com/nitishfy/helm-guestbook-app'
      targetRevision: main
      ref: values

The above error is going to get produced if the path you specified in the valueFiles doesn't exist. Can you recheck once again if the path you specified exist.