Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portion of chart.metadata.version unexpectedly treated as a number #374

Open
iainsproat opened this issue Feb 9, 2024 · 1 comment
Open

Comments

@iainsproat
Copy link

iainsproat commented Feb 9, 2024

Recreation steps

  1. Install the latest chart releaser version:

    > cr version
    GitVersion:  v1.6.1
    GitCommit:   0102fa30dd78df0d0f8093c4607e6080972ff82d
    BuildDate:   2023-10-31T07:28:18Z
    GoVersion:   go1.20.10
    Compiler:    gc
    Platform:    darwin/arm64
    License:     Apache 2.0
    
  2. Set the helm chart version as follows:

    version: 2.18.2-branch.testing.79682.0162870
  3. run cr package

  4. we receive Error: validation: chart.metadata.version "2.18.2-branch.testing.79682.0162870" is invalid

Workarounds

  • remove the leading 0 in the last set of runes following the period:

    1. Set the helm chart version as follows:

      version: 2.18.2-branch.testing.79682.162870
    2. run cr package

    3. we receive Successfully packaged chart in....

  • add one or more non-digit runes to the set of runes following the period:

    1. Set the helm chart version as follows:

      version: 2.18.2-branch.testing.79682.016a870
    2. run cr package

    3. we receive Successfully packaged chart in....

Discussion

It seems that the set of runes following a period or hyphen is interpreted as a number rather than a string if all runes are digits. The presence of the leading 0 causes an error when parsing the runes as a number. This was unexpected.

Related issues

  • AppVersion treated as decimal number #362 discusses a similar issue with appVersion, and where the entire value is numeric. This differs from this issue which identifies the problem in version and where a portion following a period.
@iainsproat
Copy link
Author

I think the issue is that it is being parsed as semver: https://github.com/helm/helm/blob/3fc9f4b2638e76f26739cd77c7017139be81d0ea/pkg/action/package.go#L107
And it doesn't seem to be a test case covered by the semver library: https://github.com/Masterminds/semver/blob/e06051f8fcc4c8b4a4990c337b9862a2448722e5/version_test.go#L10

It seems the problem might be with the pre-release naming I have used: 2.18.2-branch.testing.79682.016a870, where the use of periods in the prerelease name branch.testing.79682.016a870 is causing it to be interpreted as semver.

iainsproat added a commit to specklesystems/speckle-server that referenced this issue Feb 9, 2024
iainsproat added a commit to specklesystems/speckle-server that referenced this issue Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant