Skip to content

Commit 6d2ce08

Browse files
committed
fix (backend): store Docker-safe version as property instead of overriding component version
1 parent 1685c41 commit 6d2ce08

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

backend/src/main/java/io/reliza/service/ReleaseService.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -882,21 +882,18 @@ public List<Component> parseCustomReleaseDataIntoCycloneDxComponents(ReleaseData
882882
}
883883
}
884884

885-
// For container components, use Docker-safe version to ensure compatibility with Docker/OCI tag constraints
886-
// For all other types, keep semantic version as-is
887-
String componentVersion = version;
888-
if (cycloneComponentType == Component.Type.CONTAINER) {
889-
if (StringUtils.isNotEmpty(version)) {
890-
componentVersion = Utils.dockerTagSafeVersion(version);
891-
} else {
892-
// Container artifacts should always have a version
893-
// If missing, log warning and use 'latest' as fallback
894-
log.warn("Container artifact '{}' missing version, using 'latest' as fallback", dd.getDisplayIdentifier());
895-
componentVersion = "latest";
896-
}
885+
// Set the semantic version as-is
886+
c.setVersion(version);
887+
888+
// For container components, add Docker-safe version as a property
889+
if (cycloneComponentType == Component.Type.CONTAINER && StringUtils.isNotEmpty(version)) {
890+
String containerSafeVersion = Utils.dockerTagSafeVersion(version);
891+
var p = new Property();
892+
p.setName("reliza:containerSafeVersion");
893+
p.setValue(containerSafeVersion);
894+
props.add(p);
897895
}
898896

899-
c.setVersion(componentVersion);
900897

901898
if (null != rd.properties() && !rd.properties().isEmpty()) {
902899
List<Property> addProps = rd.properties().entrySet()

0 commit comments

Comments
 (0)