Skip to content

Feature: Support Git commit SHA as a placeholder in Custom Image Tag Pattern #7060

Open

Description

@lokesh-devtron

🔖 Feature description

Add a commit-SHA placeholder (e.g. {SHA}) to the Custom Image Tag Pattern field in the CI build stage, so generated image tags can include the Git commit hash alongside the existing {x} build counter.

Today the pattern field only recognizes {x}/{X} (the auto-incrementing build number). There is no token for the commit hash, so a pattern like dev-{commit}-{x} is rejected at save time by both the dashboard validation and the backend validateTagPattern.

Proposed: allow a pattern such as dev-{SHA}-{x} to produce a tag like dev-2c8e3eef-10667, where {SHA} resolves to the (truncated) commit hash and {x} remains the build counter.

🎤 Pitch / Usecases

In our use-case, teams want image tags that are traceable back to the exact commit while still carrying a human-readable environment prefix — e.g. dev--.

  • Traceability: seeing the commit in the tag lets anyone map a running image straight back to source without cross-referencing build logs.
  • Environment prefix: the custom-pattern field is the only place to add a prefix like "dev-", which the default tag format does not allow.
  • Uniqueness: keeping {x} in the pattern preserves the existing image-path reservation / uniqueness guarantee.

This has come up as a direct request from a customer team; the current workaround is a post-build retag step, which works but adds pipeline complexity for something that could be a first-class pattern token.

🔄️ Alternative

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or requestneeds-triageIssue is not approved or ready-to-work on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions