-
Notifications
You must be signed in to change notification settings - Fork 79
Prepare SBOM integration for GraalVM 25 #759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The failing functional tests seems unrelated to this PR, but I'm looking into it. The failing test is
Update:
The excessive printing seemed like a bug, so I tried updating |
} | ||
logger.warn(String.format("Could not generate an augmented SBOM: %s. Fallback to generating a non-augmented SBOM.", | ||
sbomGenerator.generateIfSupportedAndEnabled(config); | ||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now catch all exceptions to avoid the risk of a runtime exception bypassing this fallback mechanism.
Path sbomPath = Paths.get(outputDirectory, SBOM_FILENAME); | ||
try { | ||
/* Suppress the output from the plugin. */ | ||
int loggingLevel = logger.getThreshold(); | ||
logger.setThreshold(Logger.LEVEL_DISABLED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logging suppression was removed because it was not working. Setting the logging level like so doesn't restrict the logging in the executeMojo
call. Another PR could ensure that the output from cyclonedx-maven-plugin
is suppressed.
8d2773f
to
ae5ddac
Compare
…or `SBOMGenerator.generateIfSupportedAndEnabled`
ae5ddac
to
5b995dc
Compare
@@ -277,8 +299,10 @@ private void augmentComponentNode(JSONObject componentNode, Set<ArtifactAdapter> | |||
if (optionalArtifact.isPresent()) { | |||
ArtifactAdapter artifact = optionalArtifact.get(); | |||
JSONArray packageNamesArray = new JSONArray(); | |||
List<String> sortedPackageNames = artifact.packageNames.stream().sorted().collect(Collectors.toList()); | |||
sortedPackageNames.forEach(packageNamesArray::put); | |||
if (artifact.prunable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor orthogonal improvement.
(Shaded dependencies are correctly marked as non-prunable since we cannot be sure the packageNames
are accurate. Therefore, leaving the packageNames
array empty increases clarity.)
This PR updates the SBOM integration in the
native-maven-plugin
to handle SBOMs being embedded by default in GraalVM 25. SBOMs will be embedded even if--enable-sbom
is not passed tonative-image
. We have updated our checks accordingly to ensure the base SBOM is generated only when the SBOM feature is enabled.Additionally, the option
augmentedSBOM
has been renamed toskipBaseSBOM
. We are discontinuing the use of the term "augmented" and will instead refer to the SBOM produced bynative-maven-plugin
(and consumed bynative-image
) as the "base" SBOM. The new "skip" prefix aligns better with other configuration options.skipBaseSBOM
defaults tofalse
and when set totrue
the base SBOM is not generated.With regards to backwards compatibility, I believe the deprecation of
augmentedSBOM
should be OK given that it was just recently introduced for 24 and it's not documented in the public native-maven-plugin documentation.