Skip to content

Commit 28ee4ef

Browse files
committed
refactor(manifest): use semver parsing from OCIReference
Signed-off-by: Erik Cederberg <erik.cederberg@sectra.com>
1 parent 06f6655 commit 28ee4ef

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/manifest/manifest.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -1276,8 +1276,11 @@ func (m *Manifest) getDockerTagFromBundleRef(bundleRef cnab.OCIReference) (strin
12761276
// Docker tag is missing from the provided bundle tag, so default it
12771277
// to use the manifest version prefixed with v
12781278
// Example: bundle version is 1.0.0, so the bundle tag is v1.0.0
1279-
cleanTag := strings.ReplaceAll(m.Version, "+", "_") // Semver may include a + which is not allowed in a docker tag, e.g. v1.0.0-alpha.1+buildmetadata, change that to v1.0.0-alpha.1_buildmetadata
1280-
return fmt.Sprintf("v%s", cleanTag), nil
1279+
newRef, err := bundleRef.WithVersion(m.Version)
1280+
if err != nil {
1281+
return "", err
1282+
}
1283+
return newRef.Tag(), nil
12811284
}
12821285

12831286
// ResolvePath resolves a path specified in the Porter manifest into

0 commit comments

Comments
 (0)