how to make argocd path to a branch instead of main in the git repo

Viewed 677

I have the following:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: crm
  namespace: default
spec:
  project: default
  source:
    repoURL: <my url
    targetRevision: argocd
    path: argocd/

  destination:
    server: https://kubernetes.default.svc
    namespace: default

  syncPolicy:
    syncOptions:
    - CreateNamespace=true

    automated: 
      selfHeal: true
      prune:  true

This is working to connect argocd with the main branch, but what if I want it to follow a different branch instead?

Thank you.

1 Answers

No, your example above will make the ArgoCD application load content from:

  • repo: "<my url"
  • targetRevision (branch): "argocd"
  • path (ie. path in repo): "argocd/" meaning it won't load from main/master branch!

Use targetRevision to specify the branch you require if source is a Git repo URL.

See excerpt from the ArgoCD application.yaml docs:

  # Source of the application manifests
  source:
    repoURL: https://github.com/argoproj/argocd-example-apps.git  # Can point to either a Helm chart repo or a git repo.
    targetRevision: HEAD  # For Helm, this refers to the chart version.
    path: guestbook  # This has no meaning for Helm charts pulled directly from a Helm repo instead of git.
Related