Skip to content

Commit

Permalink
Merge pull request #203 from aloubyansky/build-id-build-system
Browse files Browse the repository at this point in the history
SBOM: add build-id and build-system properties
  • Loading branch information
aloubyansky authored Feb 22, 2023
2 parents 8d9ae9a + 24b0f9c commit 2edfce5
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

public class PncSbomTransformer implements SbomTransformer {

private static final String PNC = "PNC";
private static final String BUILD_SYSTEM = "build-system";
private static final String BUILD_ID = "build-id";
private static final String PUBLISHER = "redhat";
private static final String MRRC_URL = "https://maven.repository.redhat.com/ga/";

Expand All @@ -31,6 +34,9 @@ public class PncSbomTransformer implements SbomTransformer {
public Bom transform(SbomTransformContext ctx) {
log.info("Adding PNC build info to the manifest");
final Bom bom = ctx.getOriginalBom();
if (bom.getComponents() == null) {
return bom;
}
for (Component c : bom.getComponents()) {
if (RhVersionPattern.isRhVersion(c.getVersion())) {

Expand Down Expand Up @@ -82,10 +88,16 @@ public Bom transform(SbomTransformContext ctx) {
if (content.getBuild() == null) {
log.warn("PNC build info not found for " + url);
} else {
final Property prop = new Property();
prop.setName("pnc-build-id");
prop.setValue(content.getBuild().getId());
final List<Property> props = new ArrayList<>(c.getProperties());

Property prop = new Property();
prop.setName(BUILD_ID);
prop.setValue(content.getBuild().getId());
props.add(prop);

prop = new Property();
prop.setName(BUILD_SYSTEM);
prop.setValue(PNC);
props.add(prop);
c.setProperties(props);
}
Expand Down

0 comments on commit 2edfce5

Please sign in to comment.