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.
This commit is contained in:
Tommi Salonen 2018-01-03 08:27:31 +02:00
parent 70773f3f83
commit 3cec22aefb
1 changed files with 1 additions and 1 deletions

View File

@ -48,8 +48,8 @@ public abstract class AbstractWebHookTriggerHandler<H extends WebHook> 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);