Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ArgoCD: Provide git commit SHA to Helm values

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?

like image 393
GreNodge Avatar asked Dec 21 '25 14:12

GreNodge


1 Answers

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

To use those build environment variables with Helm, you can do as following for instance:

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

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

like image 66
Gaël J Avatar answered Dec 23 '25 18:12

Gaël J



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!