I am using Jenkins for automated integrations and deployments. I would like the build to take place after every commit to the master branch.
So I post-commit webhook, or a post receive trigger highlighted here and here and here.
So:
curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>
I am using an independent git server (So not github or bitbucket) and I would like to create this webhook / trigger.
Any ideas on how to do this?
A webhook means that you are pushing to your Git repo hosting server, which triggers a JSON payload received by any server which should react to a new push (like your Jenkins server).
But that is not exactly what is needed if one use the curl Jenkins API command highlighted in "polling must die"
You can put a post-receive hook in the bare repo to which you are pushing to (on the server side) which will call the curl command.
And the Jenkins Jobs needs to be configured with polling:
This will scan all the jobs that’s configured to check out the specified URL, and if they are also configured with polling, it’ll immediately trigger the polling (and if that finds a change worth a build, a build will be triggered in turn.)
You can see more in my previous answer "How to configure Git post commit hook".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With