Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static Long getSourceProjectId(Job job, GitLabApi gitLabApi, String projectPath)
/**
* Sends notifications to GitLab on Checkout (for the "In Progress" Status).
*/
private static void sendNotifications(Run<?, ?> build, TaskListener listener) {
private static void sendNotifications(Run<?, ?> build, TaskListener listener, Boolean useResult) {
GitLabSCMSource source = getSource(build);
if (source == null) {
return;
Expand All @@ -298,8 +298,11 @@ private static void sendNotifications(Run<?, ?> build, TaskListener listener) {
+ " configured in Jenkins global configuration.");
return;
}
Result result = build.getResult();
LOGGER.log(Level.FINE, String.format("Result: %s", result));
Result result = null;
if (useResult) {
result = build.getResult();
LOGGER.log(Level.FINE, String.format("Result: %s", result));
}

CommitStatus status = new CommitStatus();
Constants.CommitBuildState state;
Expand Down Expand Up @@ -521,7 +524,7 @@ public void onCheckout(
File changelogFile,
SCMRevisionState pollingBaseline) {
LOGGER.log(Level.FINE, String.format("SCMListener: Checkout > %s", build.getFullDisplayName()));
sendNotifications(build, listener);
sendNotifications(build, listener, false);
}
}

Expand All @@ -534,14 +537,14 @@ public static class JobCompletedListener extends RunListener<Run<?, ?>> {
@Override
public void onCompleted(Run<?, ?> build, @NonNull TaskListener listener) {
LOGGER.log(Level.FINE, String.format("RunListener: Complete > %s", build.getFullDisplayName()));
sendNotifications(build, listener);
sendNotifications(build, listener, true);
logComment(build, listener);
}

@Override
public void onStarted(Run<?, ?> run, TaskListener listener) {
LOGGER.log(Level.FINE, String.format("RunListener: Started > %s", run.getFullDisplayName()));
sendNotifications(run, listener);
sendNotifications(run, listener, false);
}
}
}