diff --git a/pom.xml b/pom.xml index 96ac625..b23a616 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 de.tum.in.www1 bamboo-server - 1.6.0 + 1.7.0 LS1 TUM https://ase.in.tum.de 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 1464cf2..63ffa22 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 @@ -29,8 +29,6 @@ import com.atlassian.bamboo.artifact.MutableArtifact; import com.atlassian.bamboo.build.BuildLoggerManager; -import com.atlassian.bamboo.build.BuildOutputLogEntry; -import com.atlassian.bamboo.build.ErrorLogEntry; import com.atlassian.bamboo.build.LogEntry; import com.atlassian.bamboo.build.artifact.ArtifactLink; import com.atlassian.bamboo.build.artifact.ArtifactLinkDataProvider; @@ -96,7 +94,7 @@ public class ServerNotificationTransport implements NotificationTransport { private static final int JOB_LOG_MAX_LINES = 5000; // We are only interested in logs coming from the build, not in logs from Bamboo - final List> logEntryTypes = ImmutableList.of(BuildOutputLogEntry.class, ErrorLogEntry.class); + final List> logEntryTypes = ImmutableList.of(LogEntry.class); public ServerNotificationTransport(String webhookUrl, @Nullable ImmutablePlan plan, @Nullable ResultsSummary resultsSummary, CustomVariableContext customVariableContext, @Nullable BuildLoggerManager buildLoggerManager, @Nullable BuildLogFileAccessorFactory buildLogFileAccessorFactory) { @@ -344,18 +342,16 @@ private JSONObject createJSONObject(Notification notification) { } List logEntries = Collections.emptyList(); - // Only add log if no tests are found (indicates a build error) - if (testResultsSummary.getTotalTestCaseCount() == 0) { - // Loading logs for job - try { - final BuildLogFileAccessor fileAccessor = this.buildLogFileAccessorFactory.createBuildLogFileAccessor(buildResultsSummary.getPlanResultKey()); - logEntries = fileAccessor.getLastNLogsOfType(JOB_LOG_MAX_LINES, logEntryTypes); - LoggingUtils.logInfo("Found: " + logEntries.size() + " LogEntries", buildLoggerManager, plan.getPlanKey(), log); - } - catch (IOException ex) { - LoggingUtils.logError("Error while loading build log: " + ex.getMessage(), buildLoggerManager, plan.getPlanKey(), log, ex); - } + // Loading logs for job + try { + final BuildLogFileAccessor fileAccessor = this.buildLogFileAccessorFactory.createBuildLogFileAccessor(buildResultsSummary.getPlanResultKey()); + logEntries = fileAccessor.getLastNLogsOfType(JOB_LOG_MAX_LINES, logEntryTypes); + LoggingUtils.logInfo("Found: " + logEntries.size() + " LogEntries", buildLoggerManager, plan.getPlanKey(), log); + } + catch (IOException ex) { + LoggingUtils.logError("Error while loading build log: " + ex.getMessage(), buildLoggerManager, plan.getPlanKey(), log, ex); } + JSONArray logEntriesArray = new JSONArray(); for (LogEntry logEntry : logEntries) { // A lambda here would require us to catch the JSONException inside the lambda, so we use a loop.