forked from jenkinsci/gitlab-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request jenkinsci#260 from jenkinsci/master
Merging down from jenkinsci
- Loading branch information
Showing
11 changed files
with
163 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import hudson.model.AbstractProject; | ||
import hudson.model.UnprotectedRootAction; | ||
import hudson.security.ACL; | ||
import hudson.security.csrf.CrumbExclusion; | ||
import jenkins.model.Jenkins; | ||
|
||
import org.acegisecurity.Authentication; | ||
|
@@ -23,6 +24,11 @@ | |
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
import javax.servlet.FilterChain; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author Honza Brázdil <[email protected]> | ||
*/ | ||
|
@@ -140,4 +146,22 @@ private Set<GhprbRepository> getRepos(String repo) { | |
|
||
return ret; | ||
} | ||
|
||
@Extension | ||
public static class GhprbRootActionCrumbExclusion extends CrumbExclusion { | ||
|
||
@Override | ||
public boolean process(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException { | ||
String pathInfo = req.getPathInfo(); | ||
if (pathInfo != null && pathInfo.equals(getExclusionPath())) { | ||
chain.doFilter(req, resp); | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public String getExclusionPath() { | ||
return "/" + URL + "/"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,6 @@ | |
import java.util.logging.Logger; | ||
import java.util.regex.Pattern; | ||
|
||
import jenkins.model.Jenkins; | ||
|
||
/** | ||
* @author Honza Brázdil <[email protected]> | ||
*/ | ||
|
@@ -111,6 +109,10 @@ public static DescriptorImpl getDscp() { | |
|
||
@Override | ||
public void start(AbstractProject<?, ?> project, boolean newInstance) { | ||
if (project.isDisabled()) { | ||
logger.log(Level.FINE, "Project is disabled, not starting trigger"); | ||
return; | ||
} | ||
this.project = project.getFullName(); | ||
if (project.getProperty(GithubProjectProperty.class) == null) { | ||
logger.log(Level.INFO, "GitHub project not set up, cannot start ghprb trigger for job " + this.project); | ||
|
@@ -149,6 +151,16 @@ public void run() { | |
if (getUseGitHubHooks()) { | ||
return; | ||
} | ||
|
||
if (helper.isProjectDisabled()) { | ||
logger.log(Level.FINE, "Project is disabled, ignoring trigger run call"); | ||
return; | ||
} | ||
|
||
if (helper == null) { | ||
logger.log(Level.SEVERE, "Helper is null, unable to run trigger"); | ||
return; | ||
} | ||
helper.run(); | ||
getDescriptor().save(); | ||
} | ||
|
Oops, something went wrong.