6

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.

pizza_pasta
  • 87
  • 1
  • 7

1 Answers1

9

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.
thikade
  • 370
  • 2
  • 4
  • The answer is correct, but the excerpt provided lists HEAD (a revision). It is possible to put a revision in `targetRevision` as argocd docs describe, whether HEAD or a tag or a commit hash. Those docs don't tell you that it can also be a branch name. – jws Jul 21 '23 at 21:43