Skip to content

Commit 1685c41

Browse files
committed
fix(backend): use Docker-safe version for container components in CycloneDX generation
1 parent 6f4b2d2 commit 1685c41

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,21 @@ public List<Component> parseCustomReleaseDataIntoCycloneDxComponents(ReleaseData
882882
}
883883
}
884884

885-
c.setVersion(version);
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+
}
897+
}
898+
899+
c.setVersion(componentVersion);
886900

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

0 commit comments

Comments
 (0)