Merge pull request #103 from TomAndrews/mr-ci-skip

Generalise ci-skip to merge requests
This commit is contained in:
bassrock 2015-08-26 10:46:29 -07:00
commit 71f9728ace
1 changed files with 10 additions and 0 deletions

View File

@ -418,6 +418,12 @@ public class GitLabWebHook implements UnprotectedRootAction {
for (org.gitlab.api.models.GitlabMergeRequest mr : mergeRequests) {
if (projectRef.endsWith(mr.getSourceBranch()) ||
(trigger.getTriggerOpenMergeRequestOnPush().equals("both") && projectRef.endsWith(mr.getTargetBranch()))) {
if (trigger.getCiSkip() && mr.getDescription().contains("[ci-skip]")) {
LOGGER.log(Level.INFO, "Skipping MR " + mr.getTitle() + " due to ci-skip.");
continue;
}
LOGGER.log(Level.FINE,
"Generating new merge trigger from "
+ mr.toString() + "\n source: "
@ -481,6 +487,10 @@ public class GitLabWebHook implements UnprotectedRootAction {
return;
}
}
if(request.getObjectAttribute().getDescription().contains("[ci-skip]")) {
LOGGER.log(Level.INFO, "Skipping MR " + request.getObjectAttribute().getTitle() + " due to ci-skip.");
return;
}
Authentication old = SecurityContextHolder.getContext().getAuthentication();
SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);