ArgoCD:向 Helm 值提供 git commit SHA

问题描述 投票:0回答:1

假设您在由 ArgoCD 管理的集群内有一个

Application
规范,例如:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: foo-app
  namespace: argocd
spec:
  destination:
    name: some-cluster
    namespace: foo-namespace
  project: default
  source:
    path: kubernetes/helm
    repoURL: https://github.com/my/great-project.git
    targetRevision: HEAD

现在假设在 Helm Chart 中,我需要访问已签出的 Git 提交 SHA,该 SHA 用于在

kubernetes/helm
中获取 Helm Chart。喜欢参考图片名称
my-registry.com/my/great-project:<COMMIT_SHA>

如何实现这一目标?

git charts kubernetes-helm argocd
1个回答
0
投票

根据 构建环境,您应该能够在 Helm 图表上使用环境变量

ARGOCD_APP_REVISION

要将这些构建环境变量与 Helm 一起使用,您可以执行以下操作:

  spec:
    source:
      helm:
        parameters:
        - name: revision
          value: $ARGOCD_APP_REVISION

来源:https://argo-cd.readthedocs.io/en/stable/user-guide/helm/#build-environment

© www.soinside.com 2019 - 2024. All rights reserved.