Hyperlinks between changes

The Github plugin decorates Jenkins "Changes" pages to create links to your Github commit and issue pages. It adds a sidebar link that links back to the Github project page.

When creating a job, specify that is connects to git. Under "Github project", put in: git@github.com:Person/Project.git Under "Source Code Management" select Git, and put in git@github.com:Person/Project.git

Trigger a build when a change is pushed to GitHub

Automatic Mode: in this mode, Jenkins will automatically add/remove hook URLs to GitHub based on the project configuration in the background. You'll specify GitHub user names and password OAuth token so that Jenkins can login as you to do this, and yes, we need your password and not API token because GitHub doesn't have an API for managing post-commit hooks.

Manual Mode: in this mode, you'll be responsible for registering the hook URLs to GitHub. Click the icon to see the URL in Jenkins that receives the post-commit POSTs.

Step 2. Open "Manage Jenkins > Configure Global Security" page and make sure that "Grant READ permissions for /github-webhook" is enabled in the "GitHub Authorization Settings" section. (If you are using the latest version of the plugin, you may not see the Github option on "Configure Global Security" page. Just go to the project configure page, in section "Build Triggers", check "Build when a change is pushed to GitHub")

Step 3. Once that configuration is done, go to the project config of each job you want triggered automatically and simply check "Build when a change is pushed to GitHub" under "Build Triggers". With this, every new push to the repository automatically triggers a new build.

Note that there's only one URL and it receives all post-receive POSTs for all your repositories. The server side of this URL is smart enough to figure out which projects need to be triggered, based on the submission.

Security Implications

This plugin requires that you have an HTTP URL reachable from GitHub, which means it's reachable from the whole internet. So it is implemented carefully with the possible malicious fake post-receive POSTS in mind. To cope with this, upon receiving a POST, Jenkins will talk to GitHub to ensure the push was actually made.

Jenkins inside a firewall

In case your Jenkins run inside the firewall and not directly reachable from the internet, this plugin lets you specify an arbitrary endpoint URL as an override in the automatic mode. The plugin will assume that you've set up reverse proxy or some other means so that the POST from GitHub will be routed to the Jenkins.

Trouble-shooting hooks

If you set this up but build aren't triggered, check the following things:

Click the "admin" button on the GitHub repository in question and make sure post-receive hooks are there.

If it's not there, make sure you have proper credential set in the Jenkins system config page.

Also, enable logging for the class name com.cloudbees.jenkins.GitHubPushTrigger and you'll see the log of Jenkins trying to install a post-receive hook.

enable logging for the class name com.cloudbees.jenkins.GitHubWebHook. Click "Test hook" button from the GitHub UI and see if you see GitHubWebBook receive a payload.

Documentation Todo:

How does this relate to the normal Git plugin? Is it also needed, or does it replace it? Does it offer the same functionality? Why is this even needed?

Does this only work with the public github or also private github instances?

Possible Issues between Jenkins and GitHub

Windows:

In windows, Jenkins will use the the SSH key of the user it is running as, which is located in the %USERPROFILE%\.ssh folder ( on XP, that would be C:\Documents and Settings\USERNAME\.ssh, and on 7 it would be C:\Users\USERNAME\.ssh). Therefore, you need to force Jenkins to run as the user that has the SSH key configured. To do that, right click on My Computer, and hit "Manage". Click on "Services". Go to Jenkins, right click, and select "Properties". Under the "Log On" tab, choose the user Jenkins will run as, and put in the username and password (it requires one). Then restart the Jenkins service by right clicking on Jenkins (in the services window), and hit "Restart".

Jenkins does not support passphrases for SSH keys. Therefore, if you set one while running the initial Github configuration, rerun it and don't set one.

Does this work over HTTPS? Does polling need to also be enabled on the job...

Does this work over HTTPS? Does polling need to also be enabled on the jobs like with the Git plugin? I'm using GitHub OAuth for auth in Jenkins. I've verified that I've got "Grant READ permissions for /github-webhook". When I "Test Hook" with the logger: com.cloudbees.jenkins.GitHubWebHook enabled, I'm not seeing anything in the log. However, when I switch to using HTTP (I've got both enabled for Jenkins) it starts working.

I'm proxying both HTTPS and HTTP to Jenkins using mod_proxy in Apache2.

Hmm, this seems to be something on the GitHub end as I'm watching my Apache logs...

Hmm, this seems to be something on the GitHub end as I'm watching my Apache logs and the Test Hook's POST to /github-webhook/ only shows up in my Apache logs when using HTTP. When using HTTPS, it doesn't even appear to hit Apache.

I've run into the exact same issue today as I am setting up a new Jenkins instan...

I've run into the exact same issue today as I am setting up a new Jenkins instance under Tomcat interacting with GitHub with the GitHub OAuth. I have the exact same setup as Bradley (even w/o the "Prevent Cross Site Request Forgery exploits" tickbox unticked). I guess it's time to shower GitHub with tickets until they handle this :)

Until then, it's time to ask ourselves which between SCM polling or allowing HTTP access is the worse evil.

I am having problems getting my Jenkins installation talking with my GitHub repo. The build log file says (obviously I have changed the repo location to my_location to keep the original location private):

ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:my_location.git
hudson.plugins.git.GitException: Could not clone git@github.com:my_location.git
at hudson.plugins.git.GitAPI.clone(GitAPI.java:252)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1122)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
at hudson.FilePath.act(FilePath.java:842)
at hudson.FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
at hudson.model.Run.execute(Run.java:1488)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\sh.exe clone -o origin git@github.com:my_location.git C:\Program Files (x86)\Jenkins\jobs\Platform\workspace" returned status code 127:
stdout:
stderr: "C:/Program Files (x86)/Git/bin/sh.exe": clone: No such file or directory
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:838)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:40)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:248)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:228)
at hudson.FilePath.act(FilePath.java:842)
at hudson.FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitAPI.clone(GitAPI.java:228)
... 13 more
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1134)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1064)
at hudson.FilePath.act(FilePath.java:842)
at hudson.FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1064)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
at hudson.model.Run.execute(Run.java:1488)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)

The settings I have used are:

Jenkins global setings for Git installation :-

Name: git

Path to Git executable: C:\Program Files (x86)\Git\bin\sh.exe

Install automatically: Not checked

Then, in the configuraion for my Jenkins Job under the Source Code Management section :-

On the PC running Jenkins, I have installed Git version 1.7.11-preview20120620 (latest version that was available at the time I downloaded). It was installed to C:\Program Files (x86)\Git\. I am using GitHub plugin v1.4 and github-api plugin v1.28. The Jenkins version is v1.476. Running on Windows Server 2008 R2 Datacenter (64bit).

I'm hoping someone can help me as I am at my wits end. We have two servers, one ...

I'm hoping someone can help me as I am at my wits end. We have two servers, one setup with jenkins running on 8080 and the other set up with gitlab. I'm trying to enable jenkins build on push to gitlab, but have been unsuccessful. I've even gone as far as downloading the source, compiling it and adding extra logging, but still nothing. The issue occurs when I'm testing the hook on gitlab. When I test the hook, I get the following error in the jenkins log:

Oct 4, 2012 12:09:34 PM com.cloudbees.jenkins.GitHubWebHook processGitHubPayload
INFO: Received payload fornull
2012-10-04 12:09:34.743:Jenkins v1.445:WARN: Error while serving http://160.129.228.150:8080/github-webhook/
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:149)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:377)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:477)
at org.kohsuke.stapler.Stapler.service(Stapler.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:203)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
Caused by: net.sf.json.JSONException: null object
at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2428)
at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1751)
at com.cloudbees.jenkins.GitHubWebHook.processGitHubPayload(GitHubWebHook.java:160)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
... 45 more
2012-10-04 12:09:34.744::WARN: EXCEPTION
javax.servlet.ServletException: net.sf.json.JSONException: null object
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:605)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:377)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:477)
at org.kohsuke.stapler.Stapler.service(Stapler.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:203)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
Caused by: net.sf.json.JSONException: null object
at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2428)
at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1751)
at com.cloudbees.jenkins.GitHubWebHook.processGitHubPayload(GitHubWebHook.java:160)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:149)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
... 36 more
2012-10-04 12:09:34.745::WARN: Nested in javax.servlet.ServletException: net.sf.json.JSONException: null object:
net.sf.json.JSONException: null object
at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2428)
at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1751)
at com.cloudbees.jenkins.GitHubWebHook.processGitHubPayload(GitHubWebHook.java:160)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:149)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:377)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:477)
at org.kohsuke.stapler.Stapler.service(Stapler.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:203)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
2012-10-04 12:09:34.745::WARN: /github-webhook/:
net.sf.json.JSONException: null object
at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2428)
at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1751)
at com.cloudbees.jenkins.GitHubWebHook.processGitHubPayload(GitHubWebHook.java:160)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:149)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:377)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:477)
at org.kohsuke.stapler.Stapler.service(Stapler.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:203)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
2012-10-04 12:09:34.746::WARN: /github-webhook/
net.sf.json.JSONException: null object
at net.sf.json.JSONObject.verifyIsNull(JSONObject.java:2428)
at net.sf.json.JSONObject.getJSONObject(JSONObject.java:1751)
at com.cloudbees.jenkins.GitHubWebHook.processGitHubPayload(GitHubWebHook.java:160)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:282)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:149)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:88)
at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:149)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:377)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:648)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:477)
at org.kohsuke.stapler.Stapler.service(Stapler.java:159)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1074)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1065)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:185)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:146)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:765)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:628)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:203)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:329)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

Which apparently is caused by a null json object. I added some more logging to the GitHubWebHook class to see what was coming in:

Nevermind as after much digging, I've realized that this plugin is intended to w...

Nevermind as after much digging, I've realized that this plugin is intended to work exactly as it says, with Github only. Github posts hooks as application/x-www-form-urlencoded and gitlab posts as application/json. After that, the actual message is different between Github and gitlab. I would not recommend trying this with gitlab and instead you the method described here: http://blog.j12r.com/2011/11/development-environment-integrate-jenkins-and-gitolite/

I just installed v1.5 of the plugin and it works great on most of my reposi...

I just installed v1.5 of the plugin and it works great on most of my repositories. There is an issue with my one project that has a few branches. The URLs generated don't match up with the actual commit URLs at Git and I get "This is not the webpage you are looking for".

Does this plugin respect the default git plugin fields to only build or ignore s...

Does this plugin respect the default git plugin fields to only build or ignore specific branches, or commits made by a specific user?

I am trying to setup a job that merges all branches into our develop branch, excluding our release and master branch, but it will build all branches even when jenkins notices that it merged a change into develop.

I was also fighting with this for couple months, until I discovered, purely by a...

I was also fighting with this for couple months, until I discovered, purely by accident, the "Grant READ permissions for /github-webhook" setting in the Configure Global Security section in Jenkins global management. This fixed it for me. I edited the setup steps on this page to add this and make it clearer.

I don't see that option available any longer under Configure Global Security, ev...

I don't see that option available any longer under Configure Global Security, even though I have the github plugin installed and as far as I can tell configured correctly. Anyone know where this option might have been moved to?

Nevermind, perhaps this is no longer necessary. It wasn't working before b...

Nevermind, perhaps this is no longer necessary. It wasn't working before because I had inconsistent full domain qualification for our internal server. E.g. in some places it was internal-github.company.com and in others it was just internal-github. When I switched them all the jenkins settings to be consistently fully qualified, everything worked.

Will this plugin allow a job to be setup to build any branch or pull request?
I...

Will this plugin allow a job to be setup to build any branch or pull request?

I've got it working for a single branch but I'd like to set the job up to work on any branch or pull request and can't seem to get the repo and branch defined to allow this. I can get it to work with pull requests only if I put a specific refspec (+refs/pull/:refs/remotes/origin/pr/) but then regular branches like master don't build.

I can't get the webhook to work. The webhook URL is reachable with a browser (it...

I can't get the webhook to work. The webhook URL is reachable with a browser (it just yields an exception telling me that it's not intended to be browsed interactively), but when I tell GitHub to test the webhook, nothing happens on Jenkins' end. The com.cloudbees.jenkins.GitHubWebHook log stays absolutely empty. I tried with both manual and automatic hook registration (the latter registered the hook just fine). Does anyone have some idea on how I can narrow the cause down?

Is there anyway of telling if a build was triggered through this plugin after a ...

Is there anyway of telling if a build was triggered through this plugin after a git commit as opposed to a manual 'build now'?

My Jenkins master is on Mac OSX which does some builds and I have a windows slave for others. I would like to be able to do different things with the builds depending on what triggered the build. I imagine this could be done with having different projects - one for manual and one for automatic builds, but I have quite a few projects already and I'm keen to keep the admin to a minimum.....

I've setup our GitHub enterprise to POST a push payload to our internal Jenkins github-webhook url but nothing happens. I've setup the com.cloudbees.jenkins.GitHubWebHook logging but nothing is getting logged. I've also tried to do a simple curl, posting a push payload to our Jenkins github-webhook url, but again nothing happens. This was working before we migrated our Jenkins on to another server. We've checked the connections and can see our GitHub enterprise server communicating to our Jenkins server and then our Jenkins server communicating back to our Github instance. But nothing gets logged and no jobs are ran. Does anyone have any ideas what the cause of the issue could be?

I've setup our GitHub enterprise to POST a push payload to our internal Jenkins github-webhook url but nothing happens. I've setup the com.cloudbees.jenkins.GitHubWebHook logging but nothing is getting logged. I've also tried to do a simple curl, posting a push payload to our Jenkins github-webhook url, but again nothing happens. This was working before we migrated our Jenkins on to another server. We've checked the connections and can see our GitHub enterprise server communicating to our Jenkins server and then our Jenkins server communicating back to our Github instance. But nothing gets logged and no jobs are ran. Does anyone have any ideas what the cause of the issue could be?

How to get access to the information in the POST payload from the Github web-hoo...

How to get access to the information in the POST payload from the Github web-hook? I gave Github the generic web-hook url to post to.

We have our build jobs made so that developers can click "build now" and then specify their own branch as a parameter in Jenkins. The parameter is passed into the build script as an environment variable. How would I make the web-hook payload information be passed into env variables as well?

There are lots of useful information in the JSON payload and it is also littered in the Jenkins UI by the Github plugin. How can I access that information? :)

EDIT: After browsing the plugin source code I see that the only thing passed into the job is the name of the person that pushed to Github. It would be nice if more meta-data could be passed into the trigger, like branch name and so on.