Skip to content

sanitizeVersion breaks helm lint because it's not semver compliant #258

@matteomazza91

Description

@matteomazza91

use case:
build and release docker images and helm charts

the issue:
Because docker tags won't accept the + symbol, I added the sanitizeVersion property

-Prelease.sanitizeVersion=true 

This replaces the + symbol with the . symbol creating a new pre-release identifier.
example from the readme:

This will generate a version string similar to: 0.1.0-dev.2.e1c43c7

The last pre-release component ( e1c43c7 ) is the shortened hash of the revision being built.

According to https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions, each of the dot-separated pre-release components should be an alphanumeric string or a number starting with a positive-digit.

So, in the event of a revision hash that has digits only and it is starting with a 0, the version created by this plugin is not SemVer compliant. ( the probability of this happening is circa 0.4%)

And apparently Helm lint is very strict about this.

[ERROR] Chart.yaml: version '1.351.0-dev.21.pr.489.0303690' is not a valid SemVer

the solution:
prepending or appending a character to the shortened revision hash could be very confusing (as it could easily be mistaken for a character of the hash).
Maybe prepending something like rev- to have 1.351.0-dev.21.pr.489.rev-0303690 could work?
(note that the symbol - is a valid non-digit in the grammar)

However I'm not sure if this could break some other use cases, so maybe we need a breaking-change or a new property to adopt this behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions