Skip to content

Commit

Permalink
replace _ with + for OCI artifacts tags when pulled for helm
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan-Adrian Burciu <bogdanadrian.burciu@yahoo.com>
  • Loading branch information
baburciu committed Oct 31, 2024
1 parent c8ae4b6 commit b2db396
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/controller/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,12 @@ func mutateChartWithSourceRevision(chart *chart.Chart, source sourcev1.Source) (
switch {
case strings.Contains(revision, "@"):
tagD := strings.Split(revision, "@")
tagVer, err := semver.NewVersion(tagD[0])
// replace '+' with '_' for OCI tag semver compatibility
// per https://github.com/helm/helm/blob/v3.14.4/pkg/registry/client.go#L45-L50
tagConverted := strings.ReplaceAll(tagD[0], "_", "+")
tagVer, err := semver.NewVersion(tagConverted)
if err != nil {
return "", fmt.Errorf("failed parsing artifact revision %s", tagD[0])
return "", fmt.Errorf("failed parsing artifact revision %s", tagConverted)
}
if len(tagD) != 2 || !tagVer.Equal(ver) {
return "", fmt.Errorf("artifact revision %s does not match chart version %s", tagD[0], chart.Metadata.Version)
Expand Down

0 comments on commit b2db396

Please sign in to comment.