ArgoCD: Provide git commit SHA to Helm values

401 Views Asked by At

Assume you have an Application spec inside a cluster which is manage by ArgoCD, like:

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

Now assuming inside the Helm Chart I need access to the checked out Git commit SHA which was used to get the Helm Chart inside kubernetes/helm. Like to reference the image name my-registry.com/my/great-project:<COMMIT_SHA>.

How to achieve this?

1

There are 1 best solutions below

1
On

According to build environment, you should be able to use the environment variable ARGOCD_APP_REVISION on your Helm chart.