Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
9ee33217d4
|
@ -302,7 +302,8 @@ public class GitLabPushTrigger extends Trigger<AbstractProject<?, ?>> {
|
||||||
if (!gitlabHostUrl.isEmpty() && (null != sourceRepository)) {
|
if (!gitlabHostUrl.isEmpty() && (null != sourceRepository)) {
|
||||||
List<GitlabProject> projects = getGitlab().instance().getProjects();
|
List<GitlabProject> projects = getGitlab().instance().getProjects();
|
||||||
for (GitlabProject project : projects) {
|
for (GitlabProject project : projects) {
|
||||||
if(project.getSshUrl().equalsIgnoreCase(sourceRepository.toString())){
|
if(project.getSshUrl().equalsIgnoreCase(sourceRepository.toString()) ||
|
||||||
|
project.getHttpUrl().equalsIgnoreCase(sourceRepository.toString())){
|
||||||
//Get all branches of project
|
//Get all branches of project
|
||||||
List<GitlabBranch> branches = getGitlab().instance().getBranches(project);
|
List<GitlabBranch> branches = getGitlab().instance().getBranches(project);
|
||||||
for (GitlabBranch branch : branches){
|
for (GitlabBranch branch : branches){
|
||||||
|
|
|
@ -15,6 +15,7 @@ import hudson.plugins.git.util.Build;
|
||||||
import hudson.plugins.git.util.BuildData;
|
import hudson.plugins.git.util.BuildData;
|
||||||
import hudson.scm.SCM;
|
import hudson.scm.SCM;
|
||||||
import hudson.security.ACL;
|
import hudson.security.ACL;
|
||||||
|
import hudson.security.csrf.CrumbExclusion;
|
||||||
import hudson.util.HttpResponses;
|
import hudson.util.HttpResponses;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -29,7 +30,10 @@ import java.util.ListIterator;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.servlet.FilterChain;
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import jenkins.model.Jenkins;
|
import jenkins.model.Jenkins;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
@ -520,4 +524,21 @@ public class GitLabWebHook implements UnprotectedRootAction {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Extension
|
||||||
|
public static class GitlabWebHookCrumbExclusion extends CrumbExclusion {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean process(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException {
|
||||||
|
String pathInfo = req.getPathInfo();
|
||||||
|
if (pathInfo != null && pathInfo.startsWith(getExclusionPath())) {
|
||||||
|
chain.doFilter(req, resp);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getExclusionPath() {
|
||||||
|
return '/' + WEBHOOK_URL + '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue