Reputation: 391
I am working on PHP project using Git [ For version control ] , PHPUNIT [ Unit Test ] and Jenkins [ CI ], Now i have to setup system so that when I use command "Git Merge", Jenkins job should start to run unit cases using window environment.Did I need any Jenkins plugin or something else to achieve this.
Upvotes: 1
Views: 705
Reputation: 1327024
It depends what repo your Jenkins job is setup to monitor.
You need at least the Git plugin for Jenkins.
If it is directly the Git repo in which you just merged commits, you could setup a post-merge
hook which will notify your Jenkins of the new merged commit.
It you are pushing the branch receiving the merge to a remote GitHub repo, then you would need the GitHub plugin for Jenkins, and a post-receive hook.
In both cases, you can setup your hook in order to notify your Jenkins server that a poll is required, to get the new commits on a specific branch and launch the job.
To minimize the delay between a push and a build, it is recommended to set up the
post-receive
hook in the repository to poke Jenkins when a new commit is made. To do this, add the following line in your hooks/post-receive where "URL of the Git repository" is the fully URL you use to clone this repository.
curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>[&branches=branch1[,branch2]*][&sha1=<commit ID>]
This will scan all the jobs that's configured to check out the specified URL, the optional branches, 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).
We require the polling configuration on the job so that we only trigger jobs that are supposed to be kicked from changes in the source tree.
Upvotes: 1