From 3cec22aefb5cedc7d567962dc20009b10e2c9e22 Mon Sep 17 00:00:00 2001 From: Tommi Salonen Date: Wed, 3 Jan 2018 08:27:31 +0200 Subject: [PATCH] Moved cancelling pending builds to be done before setting build status pending. The other order caused problems when the pending build had the same commit as the new one: the build for the commit was shown as cancelled in Gitlab even though it was pending in Jenkins. --- .../trigger/handler/AbstractWebHookTriggerHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/AbstractWebHookTriggerHandler.java b/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/AbstractWebHookTriggerHandler.java index 44fbeda..e0e6136 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/AbstractWebHookTriggerHandler.java +++ b/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/AbstractWebHookTriggerHandler.java @@ -48,8 +48,8 @@ public abstract class AbstractWebHookTriggerHandler implement String targetBranch = getTargetBranch(hook); if (branchFilter.isBranchAllowed(targetBranch)) { LOGGER.log(Level.INFO, "{0} triggered for {1}.", LoggerUtil.toArray(job.getFullName(), getTriggerType())); - setCommitStatusPendingIfNecessary(job, hook); cancelPendingBuildsIfNecessary(job, hook); + setCommitStatusPendingIfNecessary(job, hook); scheduleBuild(job, createActions(job, hook)); } else { LOGGER.log(Level.INFO, "branch {0} is not allowed", targetBranch);