文档

仓库管理

更新时间:

本文介绍如何在GitOps系统中,通过ArgoCD CLI和ArgoCD控制台方式添加、查看及删除Git源仓库和Helm源仓库。

前提条件

已登录GitOps系统。具体操作,请参见登录GitOps系统

添加仓库

添加Git源仓库

您可以通过以下几种方式添加Git源仓库。

  • 执行以下命令,添加示例应用的Git源仓库到GitOps系统中。

    argocd repo add https://github.com/AliyunContainerService/gitops-demo.git

    预期输出:

    Repository 'https://github.com/AliyunContainerService/gitops-demo.git' added
  • 执行以下命令,使用用户名密码,通过HTTPS添加私有Git源仓库。

    argocd repo add https://git.example.com/repos/repo --username git --password secret
  • 执行以下命令,使用私钥证书,通过SSH协议添加Git源仓库并忽略服务器证书校验。

    argocd repo add git@git.example.com:repos/repo --insecure-ignore-host-key --ssh-private-key-path ~/id_rsa

执行以下命令,查看更多参数的使用说明。

argocd repo add --help

添加Helm源仓库

您可以通过以下几种方式添加Helm源仓库。

  • 执行以下命令,通过HTTPS添加公共Helm仓库并命名。

    argocd repo add https://charts.helm.sh/stable --type helm --name mystable
  • 执行以下命令,使用用户名密码,通过HTTPS添加私有Helm仓库并命名。

    argocd repo add https://charts.helm.sh/stable --type helm --name mystable --username test --password test
  • 执行以下命令,通过HTTPS添加私有Helm OCI-based仓库并命名。

    argocd repo add helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name mystable --enable-oci --username test --password test

查看仓库列表

执行以下命令,查看仓库列表。

argocd repo list

预期输出:

TYPE  NAME      REPO                                                       INSECURE  OCI    LFS    CREDS  STATUS      MESSAGE  PROJECT
helm  mystable  https://charts.helm.sh/stable                              false     false  false  false  Successful           
git             https://github.com/AliyunContainerService/gitops-demo.git  true      false  false  false  Successful           default

删除仓库

执行以下命令,删除Git源仓库。若需要删除Helm仓库,将命令中的Git仓库地址替换为Helm仓库地址即可。

argocd repo rm https://github.com/AliyunContainerService/gitops-demo.git

预期输出:

Repository 'https://github.com/AliyunContainerService/gitops-demo.git' removed

相关操作

除了ArgoCD CLI方式,您也可以通过ArgoCD控制台管理仓库源,操作入口如下:

登录ArgoCD UI,在左侧导航栏选择Settings,然后选择Repositories > + Connect Repo

  • 本页导读 (1)
文档反馈