You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用HTTP访问令牌从ARGO-WF访问Git仓库?

如何在Argo Workflow中使用HTTP访问令牌访问私有Git仓库

步骤1:创建存储HTTP令牌的Kubernetes Secret

先把你的HTTP访问令牌存入K8s Secret,避免明文暴露:

kubectl create secret generic git-http-token --from-literal=token=[你的HTTP-TOKEN]

替换[你的HTTP-TOKEN]为实际令牌内容。

步骤2:修改Workflow配置

在原有Workflow的Git artifact配置中添加Secret引用,同时替换为你的私有仓库地址:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: input-artifact-git-
spec:
  entrypoint: git-clone
  templates:
  - name: git-clone
    inputs:
      artifacts:
      - name: argo-source
        path: /src
        git:
          repo: https://code.company.com/scm/tc_pbms/report_configs.git
          secretName: git-http-token  # 引用创建好的Secret
          username: ""  # Bearer认证无需实际用户名,设为空即可
    container:
      image: alpine
      command: [sh, -c]
      args: ["cd /src; ls"]
      workingDir: /src

说明

Argo的Git artifact组件会读取Secret中的token字段作为密码,当username为空时,自动生成Authorization: Bearer <token>请求头,和你在终端执行的git clone命令效果一致,完成私有仓库的认证访问。

内容的提问来源于stack exchange,提问作者olli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 08:02:39