trigger local jenkins with github

850 views
Skip to first unread message

Stefan Bauer

unread,
Jan 8, 2014, 4:06:16 AM1/8/14
to jenkins...@googlegroups.com
Hello,

general is it possible to trigger a local jenkins job, when a push to github repositorie was made? Since about one month I work on this problem. At the moment I use the following plugins:

git
github
github oauth

I tried a lot of things out, but nothing worked :-(

I need help. PLEASE :-)

Best regards
Stefan

Marius Gedminas

unread,
Jan 8, 2014, 6:26:19 AM1/8/14
to jenkins...@googlegroups.com
On Wed, Jan 08, 2014 at 01:06:16AM -0800, Stefan Bauer wrote:
> general is it possible to trigger a local jenkins job, when a push to
> github repositorie was made?

Yes. You have two options:

1. Dumb and simple: enable polling

2. Smart and efficient but more complicated: enable the GitHub plugin,
register a web hook, make sure the GitHub plugin endpoint of your
local Jenkins is accessible from the internet without authentication,
oh and disable CSRF protection until
https://issues.jenkins-ci.org/browse/JENKINS-20140 gets fixed.

> Since about one month I work on this problem.
> At the moment I use the following plugins:
>
> git
> github
> github oauth
>
> I tried a lot of things out, but nothing worked :-(
>
> I need help. PLEASE :-)

If you tell us precisely what you tried, maybe we can spot what went
wrong. Maybe.

Marius Gedminas
--
I know dealing with upstream is always a pain and feels like twice as much work
as just hacking around their problems in your own code, but generally pays off
long-term.
-- Martin (gzlist)
signature.asc

Stefan Bauer

unread,
Jan 9, 2014, 2:49:23 AM1/9/14
to jenkins...@googlegroups.com
Hello Marius,

I want to use the second method, because efficiency is really important to my project.

I tried this configuration:

Jenkins GitHub Plugin (Version 1.8):
   Configure System/
      GitHub User Login: mustermann
      GitHub User Password: my_oauth_token
      GitHub Web Hook: Manually manage hook URLs

GitHub Web Hook:
   Spoon-Knife(its my test repository)/Settings/Service Hooks/WebHook URLs/
      URL: http://jenkins-mustermann:8080/github-webhook/

for this: "make sure the GitHub plugin endpoint of your local Jenkins is accessible from the internet without authentication" For this I thought I must use the following plugin->

Jenkins GitHub Oauth Plugin (Version 0.14):
   Profile/Applications/Developer applications/
      Homepage URL: http://jenkins-mustermann:8080/
      Authorization callback URL: http://jenkins-mustermann:8080/securityRealm/finishLogin
      Application description: OAuth Mustermann

CSRF: disabled

My Result on http://jenkins-mustermann:8080/github-webhook/? after "Test Hook" on GitHub

Status Code: 500

Exception: java.lang.IllegalArgumentException: Not intended to be browsed interactively (must specify payload parameter)
Stacktrace:
javax.servlet.ServletException: java.lang.IllegalArgumentException: Not intended to be browsed interactively (must specify payload parameter)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:719)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
	at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:384)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:770)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:583)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:214)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
	at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
	at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:203)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:181)
	at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:86)
	at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:84)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:98)
	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
	at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:48)
	at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.ApiTokenFilter.doFilter(ApiTokenFilter.java:64)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
	at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50)
	at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
	at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
	at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
	at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
	at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:227)
	at winstone.RequestHandlerThread.run(RequestHandlerThread.java:150)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:701)
Caused by: java.lang.IllegalArgumentException: Not intended to be browsed interactively (must specify payload parameter)
	at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:622)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:288)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:151)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:90)
	at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:156)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:677)
	... 60 more



Did I do something wrong or did I miss some settings?

Thanks for your help!

Regards Stefan

Marius Gedminas

unread,
Jan 9, 2014, 1:22:25 PM1/9/14
to jenkins...@googlegroups.com
On Wed, Jan 08, 2014 at 11:49:23PM -0800, Stefan Bauer wrote:
> Hello Marius,
>
> I want to use the second method, because efficiency is really important to
> my project.
>
> I tried this configuration:
>
> *Jenkins GitHub Plugin (Version 1.8):*
> Configure System/
> GitHub User Login: mustermann
> GitHub User Password: my_oauth_token
> GitHub Web Hook: Manually manage hook URLs
>
> *GitHub Web Hook:*
> Spoon-Knife(its my test repository)/Settings/Service Hooks/WebHook URLs/
> URL: http://jenkins-mustermann:8080/github-webhook/

That URL cannot be accessed outside of your LAN. GitHub's servers most
likely are outside your local LAN.

> for this: "make sure the GitHub plugin endpoint of your local Jenkins is
> accessible from the internet without authentication" For this I thought I
> must use the following plugin->

Um, no, this part is where you need to have a public domain pointing to
an external IP address, and appropriate firewall configuration (or,
better, a reverse proxy).

> *Jenkins GitHub Oauth Plugin (Version 0.14):*
> Profile/Applications/Developer applications/
> Homepage URL: http://jenkins-mustermann:8080/
> Authorization callback URL:
> http://jenkins-mustermann:8080/securityRealm/finishLogin
> Application description: OAuth Mustermann
>
> *CSRF:* disabled
>
> *My Result on http://jenkins-mustermann:8080/github-webhook/? after "Test
> Hook" on GitHub*

These two things are unrelated.

If you want to use "Test Hook" on GitHub, first enable some logging on
the Jenkins side, and then check the logs after.

If you want to test locally, well, you did.

> Status Code: 500
> Exception: java.lang.IllegalArgumentException: Not intended to be browsed
> interactively (must specify payload parameter)

Yes, this is expected. (Stupid, IMHO, but expected. If I had enough
spare time and energy, I'd submit a patch to the plugin to make this
page show something meaningful when browsed interactively, perhaps show
whether/when it was last accessed as a webhook.)

> Did I do something wrong or did I miss some settings?

The externally-accessible webhook URL bit, see above.

Marius Gedminas
--
(ಠಿ_ಠಿ)
signature.asc

Stefan Bauer

unread,
Jan 10, 2014, 6:01:34 AM1/10/14
to jenkins...@googlegroups.com
Hallo Marius,

thanks for your help. So I will work these things out! My feedback follows in a few days :-)


Regards
Stefan

Am Mittwoch, 8. Januar 2014 10:06:16 UTC+1 schrieb Stefan Bauer:

Stefan Bauer

unread,
Jan 16, 2014, 3:14:15 AM1/16/14
to jenkins...@googlegroups.com
I got it,

after changing my private jenkins server to a public one I got the plugin to work.

Thank you very much!!!!!! :-)



Best regards
Stefan

Sameer Chandekar

unread,
Nov 25, 2014, 2:43:58 AM11/25/14
to jenkins...@googlegroups.com

Hi stefan,
 
I am also trying to trigger a build job on my local jenkins server from Github webhook.
So could you please tell how to make jenkins to publically accesible.
 
Thanks,
Sameer Chandekar
Reply all
Reply to author
Forward
0 new messages