如何在 git 存储库中将 argocd 路径设置为分支而不是 main

piz*_*sta 7 yaml github argocd

我有以下内容:

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

Run Code Online (Sandbox Code Playgroud)

这正在将 argocd 与主分支连接起来,但是如果我希望它遵循不同的分支怎么办?

谢谢。

thi*_*ade 10

不,上面的示例将使 ArgoCD 应用程序从以下位置加载内容:

  • 回购:“<我的网址”
  • targetRevision(分支):“argocd”
  • 路径(即存储库中的路径):“argocd/”意味着它不会从 main/master 分支加载!

如果源是 Git 存储库 URL,请使用targetRevision指定所需的分支。

请参阅 ArgoCD application.yaml文档的摘录:

  # 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.
Run Code Online (Sandbox Code Playgroud)