From cd6e2df63fce5dd17a9d39ef6965fee07560c0d6 Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Wed, 26 Aug 2015 11:47:25 +0100 Subject: [PATCH] Generalise ci-skip to merge requests Won't build or re-build a merge request which has "[ci-skip]" in the description. --- .../com/dabsquared/gitlabjenkins/GitLabWebHook.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/dabsquared/gitlabjenkins/GitLabWebHook.java b/src/main/java/com/dabsquared/gitlabjenkins/GitLabWebHook.java index e62318c..11467c2 100644 --- a/src/main/java/com/dabsquared/gitlabjenkins/GitLabWebHook.java +++ b/src/main/java/com/dabsquared/gitlabjenkins/GitLabWebHook.java @@ -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);