From 5d4ec91727dcd7a178c0ddaa4747bb8d5b39d968 Mon Sep 17 00:00:00 2001 From: "andrzej.janczak" Date: Fri, 10 Jul 2026 11:38:04 +0200 Subject: [PATCH] fix: sanitize all-numeric leading-zero short shas in generated version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-version emits -..sha. on non-release branches. When the short sha is all-numeric with a leading zero (e.g. sha.0238954244), it is an invalid SemVer prerelease identifier — numeric identifiers must not have leading zeroes — and helm rejects the chart version, failing the pipeline (seen on codacy-website PR #2172). Prefix such shas with "g" (git-describe convention) so the identifier becomes alphanumeric, where leading zeroes are legal. Valid versions pass through untouched. Co-Authored-By: Claude Opus 4.8 --- src/jobs/checkout_and_version.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/jobs/checkout_and_version.yml b/src/jobs/checkout_and_version.yml index 9cf92d7b..d238ec59 100644 --- a/src/jobs/checkout_and_version.yml +++ b/src/jobs/checkout_and_version.yml @@ -40,6 +40,14 @@ steps: name: Set version command: /bin/git-version --dev-branch "<>" --release-branch "<>" --version-prefix "<>" > .version + - run: + name: Sanitize version + # git-version emits -..sha. on non-release branches. + # If the short sha happens to be all-numeric with a leading zero (e.g. sha.0238954244), + # it is an invalid SemVer prerelease identifier and helm rejects the chart version. + # Prefix such shas with "g" (git-describe convention) to keep the identifier alphanumeric. + command: sed -E -i 's/\.sha\.(0[0-9]+)$/.sha.g\1/' .version + - run: name: Current version command: cat .version