Reputation: 19
guys!! I'm trying to set up Jenkins-ci for a project that uses GIT as a local version control of my repositories. I've already set up jenkins with the appropriate plugins. I want jenkins to run build scripts only whenever someone on the project pushes to master, just only can get information to GitHub,GitLab,etc but it is useless. So far I've been able to set it up so that a build will be triggered anytime anyone pushes to anywhere.
I would like to know how set up a Jenkins' task to build automatically a project when make git push to my repository
Upvotes: 1
Views: 1489
Reputation: 1685
According to the Git Plugin Documentation, you need to set up a post-recieve hook for git to notify jenkins when your repo is pushed to.
curl http://yourserver/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>]
On the jenkins side, set your job to point to the repo and branches you want to build, and turn on Build Triggers > Poll SCM (don't fill in the schedule field). Oh, and set branches to build to master.
Upvotes: 1