From 05942fe1054cfdd9126dffdbae9ce19588626473 Mon Sep 17 00:00:00 2001 From: Stephan Krusche Date: Sun, 11 Jul 2021 13:29:08 +0200 Subject: [PATCH] add more logging --- pom.xml | 2 +- .../de/tum/in/www1/bamboo/server/BuildCompleteListener.java | 4 ++++ .../in/www1/bamboo/server/ServerNotificationRecipient.java | 1 - .../in/www1/bamboo/server/ServerNotificationTransport.java | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c1faa98..0ef7941 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 de.tum.in.www1 bamboo-server - 1.3.5 + 1.3.6 LS1 TUM https://ase.in.tum.de diff --git a/src/main/java/de/tum/in/www1/bamboo/server/BuildCompleteListener.java b/src/main/java/de/tum/in/www1/bamboo/server/BuildCompleteListener.java index 62bae61..bccb207 100644 --- a/src/main/java/de/tum/in/www1/bamboo/server/BuildCompleteListener.java +++ b/src/main/java/de/tum/in/www1/bamboo/server/BuildCompleteListener.java @@ -3,13 +3,17 @@ import com.atlassian.bamboo.v2.build.CurrentBuildResult; import com.atlassian.bamboo.v2.build.events.PostBuildCompletedEvent; import com.atlassian.event.api.EventListener; +import org.apache.log4j.Logger; import java.util.Collections; public class BuildCompleteListener { + private static final Logger log = Logger.getLogger(BuildCompleteListener.class); + @EventListener public void onPostBuildComplete(final PostBuildCompletedEvent postBuildCompletedEvent) { + log.info("[BAMBOO-SERVER-NOTIFICATION] onPostBuildComplete: " + postBuildCompletedEvent.getPlanResultKey().toString()); CurrentBuildResult currentBuildResult = postBuildCompletedEvent.getContext().getBuildResult(); ResultsContainer resultsContainer = new ResultsContainer(postBuildCompletedEvent.getPlanResultKey(), currentBuildResult.getSuccessfulTestResults() != null ? currentBuildResult.getSuccessfulTestResults() : Collections.emptySet(), diff --git a/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationRecipient.java b/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationRecipient.java index c6d100b..0174fa8 100644 --- a/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationRecipient.java +++ b/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationRecipient.java @@ -26,7 +26,6 @@ public class ServerNotificationRecipient extends AbstractNotificationRecipient implements DeploymentResultAwareNotificationRecipient, NotificationRecipient.RequiresPlan, NotificationRecipient.RequiresResultSummary - { private static String WEBHOOK_URL = "webhookUrl"; diff --git a/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java b/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java index b37de2a..84f90fe 100644 --- a/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java +++ b/src/main/java/de/tum/in/www1/bamboo/server/ServerNotificationTransport.java @@ -140,6 +140,7 @@ public ServerNotificationTransport(String webhookUrl, } public void sendNotification(@NotNull Notification notification) { + log.info("[BAMBOO-SERVER-NOTIFICATION] start send notification for plan: " + plan.getPlanKey()); logToBuildLog("Sending notification"); try { HttpPost method = setupPostMethod(); @@ -197,6 +198,7 @@ public void sendNotification(@NotNull Notification notification) { logErrorToBuildLog("Error parsing webhook url: " + e.getMessage()); log.error("Error parsing webhook url: " + e.getMessage(), e); } + log.info("[BAMBOO-SERVER-NOTIFICATION] finish send notification for plan: " + plan.getPlanKey()); } private HttpPost setupPostMethod() throws URISyntaxException {