Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/jobs/checkout_and_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ steps:
name: Set version
command: /bin/git-version --dev-branch "<<parameters.dev_branch>>" --release-branch "<<parameters.release_branch>>" --version-prefix "<<parameters.version_prefix>>" > .version

- run:
name: Sanitize version
# git-version emits <base>-<branch>.<n>.sha.<shortsha> 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The .previous_version file (generated on line 57) is also created by /bin/git-version and can suffer from the exact same invalid SemVer issue if its short sha is all-numeric with a leading zero.

To maintain consistency and prevent potential pipeline failures when the previous version is referenced, please add a similar sanitization step for .previous_version right after it is generated:

- run:
    name: Sanitize previous version
    command: sed -E -i 's/\.sha\.(0[0-9]+)$/.sha.g\1/' .previous_version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we use previous_version 🤔 for smth
so not doing it now


- run:
name: Current version
command: cat .version
Expand Down