From efe2c293357649c0de7755f5e2539860efe845f3 Mon Sep 17 00:00:00 2001 From: Ross Murphy Date: Fri, 3 May 2024 13:59:32 +0100 Subject: [PATCH] Create a new entry in the msteams pebble format for BOM_PROCESS_FAILED to include the project URL and Name and add to test Previously there was no information as to what project was affected by the failed upload. Signed-off-by: Ross Murphy --- .../notification/publisher/msteams.peb | 23 +++++++++++++++++++ .../publisher/MsTeamsPublisherTest.java | 16 +++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/main/resources/templates/notification/publisher/msteams.peb b/src/main/resources/templates/notification/publisher/msteams.peb index 08c585e08a..2e7e65e322 100644 --- a/src/main/resources/templates/notification/publisher/msteams.peb +++ b/src/main/resources/templates/notification/publisher/msteams.peb @@ -96,6 +96,29 @@ "value": "{{ subject.project.toString | escape(strategy="json") }}" } ], + {% elseif notification.group == "BOM_PROCESSING_FAILED" %} + "facts": [ + { + "name": "Level", + "value": "{{ notification.level | escape(strategy="json") }}" + }, + { + "name": "Scope", + "value": "{{ notification.scope | escape(strategy="json") }}" + }, + { + "name": "Group", + "value": "{{ notification.group | escape(strategy="json") }}" + }, + { + "name": "Project", + "value": "{{ subject.project.toString | escape(strategy="json") }}" + }, + { + "name": "Project URL", + "value": "{{ baseUrl }}/projects/{{ subject.project.uuid | escape(strategy='json') }}" + } + ], {% else %} "facts": [ { diff --git a/src/test/java/org/dependencytrack/notification/publisher/MsTeamsPublisherTest.java b/src/test/java/org/dependencytrack/notification/publisher/MsTeamsPublisherTest.java index 987a930600..a7f22ed354 100644 --- a/src/test/java/org/dependencytrack/notification/publisher/MsTeamsPublisherTest.java +++ b/src/test/java/org/dependencytrack/notification/publisher/MsTeamsPublisherTest.java @@ -97,6 +97,14 @@ public void testInformWithBomProcessingFailedNotification() { { "name": "Group", "value": "BOM_PROCESSING_FAILED" + }, + { + "name": "Project", + "value": "pkg:maven/org.acme/projectName@projectVersion" + }, + { + "name": "Project URL", + "value": "https://example.com/projects/c9c9539a-e381-4b36-ac52-6a7ab83b2c95" } ], "text": "An error occurred while processing a BOM" @@ -135,6 +143,14 @@ public void testInformWithBomProcessingFailedNotificationAndNoSpecVersionInSubje { "name": "Group", "value": "BOM_PROCESSING_FAILED" + }, + { + "name": "Project", + "value": "pkg:maven/org.acme/projectName@projectVersion" + }, + { + "name": "Project URL", + "value": "https://example.com/projects/c9c9539a-e381-4b36-ac52-6a7ab83b2c95" } ], "text": "An error occurred while processing a BOM"