helm / helm/chart-releaser

Portion of `chart.metadata.version` unexpectedly treated as a number

Open
#374 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
783
Forks
126
Avg merge
1d 18h
Merged PRs (30d)
11

Description

## 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
```

1. Set the helm chart version as follows:

```yaml
version: 2.18.2-branch.testing.79682.0162870
```

1. run `cr package`
1. 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:

```yaml
version: 2.18.2-branch.testing.79682.162870
```

1. run `cr package`
1. 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:

```yaml
version: 2.18.2-branch.testing.79682.016a870
```

1. run `cr package`
1. 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

- https://github.com/helm/chart-releaser/issues/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.