argocdargogitops

ArgoCD: Multiple sources for a helm chart


Multiple sources for a helm chart: I have configured multiple sources to fetch helm templates from one repo and values from different repo.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: test-app
  namespace: argocd
spec:
  sources:
    - repoURL: 'https://github.com/org/values-repo.git'
      targetRevision: branch1
      ref: valuesRepo
      helm:
        releaseName: sample-release
    - repoURL: 'https://github.com/org/helm-chart.git' 
      chart: branch1
      targetRevision: 0.1.0
      helm:
        releaseName: sample-release
        valueFiles:
          - $valuesRepo/helm-values/development/sample-values.yaml
  destination:
    name: 'dev-cluster'
    namespace: 'test-ns'
  project: test-project

Error:

Failed to load target state: failed to generate manifest for source 2 of 2: rpc error: code = Unknown desc = helm pull --destination /tmp/a59cfffe-fe29-4196-90b3-965445e41d68 --version 0.1.1 --username ****** --password ****** --repo https://github.com/org/helm-chart.git charts/test-chart failed exit status 1: Error: looks like "https://github.com/org/helm-chart.git" is not a valid chart repository or cannot be reached: failed to fetch https://github.com/org/helm-chart.git/index.yaml : 404 Not Found

Does multipe sources expects helm-chart only as package? I haven't packaged my helm-charts.


Solution

  • apiVersion: argoproj.io/v1alpha1
    kind: Application
    metadata:
      name: test-app
      namespace: argocd
    spec:
      sources:
        - repoURL: 'https://github.com/org/values-repo.git'
          targetRevision: branch1
          ref: valuesRepo
          helm:
            releaseName: sample-release
        - repoURL: 'https://github.com/org/helm-chart.git' 
          path: path_to_your_helm_chart
          targetRevision: git-branch-name
          helm:
            releaseName: sample-release
            valueFiles:
              - $valuesRepo/helm-values/development/sample-values.yaml
      destination:
        name: 'dev-cluster'
        namespace: 'test-ns'
      project: test-project
    

    This worked for me, i was specifying chart: in the helm-chart reference; it should be path: to the helm chart and targetRevision: being your git branch.