Skip to content

Build environment variable for the resolved target revision #20768

@eadred

Description

@eadred

Summary

Tag tracking allows us to set a target revision for a git repo or Helm chart as a range (eg 1.*). It would be useful if there were a build environment variable which contains the tag/revision which the target revision range resolved to, for example 1.2.3.

None of the existing build environment variables do this. ARGOCD_APP_SOURCE_TARGET_REVISION will be set to 1.* (in this example), and ARGOCD_APP_REVISION will be set to the commit hash (eg f913b6cbf58aa5ae5ca1f8a2b149477aebcbd9d8).

Motivation

Consider a git repo containing service code and a Helm chart, and an accompanying CI build process which builds a docker image from the service code. When tagging the repo with a release tag (eg 1.2.3) the image gets built with a tag matching the release tag.

In this case when setting a target revision like 1.* we would also need to set/override a Helm value for the image tag too. It would be useful to be able to do this with a build variable, for example:

source:
  targetRevision: 1.*
  helm:
    parameters:
      - name: imageTag
        value: "$<some build var that will resolve to 1.2.3>"

Proposal

Adding a new build environment variable called ARGOCD_APP_SOURCE_TARGET_REVISION_RESOLVED or similar, which will be set to the resolved SemVer value. If the target revision is not a SemVer range then ARGOCD_APP_SOURCE_TARGET_REVISION_RESOLVED can be set to the target revision (ie the same as ARGOCD_APP_SOURCE_TARGET_REVISION.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions