Reputation: 2082
I'm trying to set up jenkins so that when a commit on a repo is detected, the build in jenkins automatically triggers. I've been reading this post: How can I make Jenkins CI with git trigger on pushes to master?
But it's not clear to me where I create the git hook "post-receive". So far, I've tried two different spots:
Neither one is working. This is what the post-receive file looks like:
me@jenkinslab:/var/lib/jenkins/jobs/test git repo/workspace/.git/hooks$ cat post-receive
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
curl http://10.1.1.11:8080/jenkins/git/notifyCommit?url=http://git.someinternaldomain.net/cgit/testing.git[&branches=branch1[,branch2]*][&sha1=<commit ID>]
In addition to creating this file, in my jenkins project, i have the "Poll SCM" option checked off under the "Build Triggers" section, but nothing as far as schedule defined.
Can you tell me what I'm missing?
Please and thanks.
Upvotes: 0
Views: 1252
Reputation: 6458
This should be triggered from the post-receive hook (not the post-update) on the GIT server.
What kind of git server are you using? The solution may be different for each kind of server (github, BitBucket, etc.).
Upvotes: 0
Reputation: 6847
It goes on the git server. If you're using github.com, then they have it all set up for you in the UI, you just need to put the URL in the right place: Your repo, Settings, Webhooks and Services.
Upvotes: 1