From 8a006afe8bc12aa4306b9d66d3c9f98f5d391abb Mon Sep 17 00:00:00 2001 From: Marek Goldmann Date: Fri, 27 Sep 2024 13:06:12 +0200 Subject: [PATCH] fix(SBOMER-166): proper handling of umb notifications for non-product-related manifests Failure in sending messages for non-product related manifests should not be fatal. --- .../image/syft/controller/SyftImageController.java | 3 ++- .../sbom/features/umb/producer/NotificationService.java | 5 +++-- .../feature/sbom/umb/producer/NotificationServiceIT.java | 8 +------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/generator/image/syft/controller/SyftImageController.java b/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/generator/image/syft/controller/SyftImageController.java index 348c7999f..97bffacf8 100644 --- a/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/generator/image/syft/controller/SyftImageController.java +++ b/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/generator/image/syft/controller/SyftImageController.java @@ -205,7 +205,8 @@ protected UpdateControl reconcileGenerating( generationRequest, SbomGenerationStatus.FAILED, GenerationResult.ERR_GENERATION, - "Generation failed. One or more generated SBOMs failed validation: {}. See logs for more information.", e.getMessage()); + "Generation failed. One or more generated SBOMs failed validation: {}. See logs for more information.", + e.getMessage()); } try { diff --git a/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/umb/producer/NotificationService.java b/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/umb/producer/NotificationService.java index 3b3863a86..13ba7cabc 100644 --- a/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/umb/producer/NotificationService.java +++ b/service/src/main/java/org/jboss/sbomer/service/feature/sbom/features/umb/producer/NotificationService.java @@ -128,10 +128,11 @@ public void notifyCompleted(List { - notificationService.notifyCompleted(List.of(sbom)); - }); - - assertEquals( - "Could not retrieve product configuration from the main component (purl = 'pkg:maven/com.github.michalszynkiewicz.test/empty@1.0.0.redhat-00271?type=jar') in the '416640206274228333' SBOM, skipping sending UMB notification", - ex.getMessage()); + notificationService.notifyCompleted(List.of(sbom)); verify(amqpMessageProducer, times(0)).notify(any(GenerationFinishedMessageBody.class)); }