post receive commit is causing all the jobs to be triggered

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

post receive commit is causing all the jobs to be triggered

Maneesh M P
Hello,

   I have a jenkins + git build environment . Currently my builds are configured to poll for scm changes in every 5 minutes, if it detects a change, builds gets triggered.  To get rid of the scm polling, I have configured a post-receive git hooks.

I have the below command inside the hook,

 curl http://jenkins.abc.com:8081/git/notifyCommit?url=[hidden email]:test-repo.git

This works great and it schedules the job if "poll SCM" option is enabled. But the problem is

I have two pipeline jobs, one for master branch and one for release branch. When i configured the Jenkins polling, it polls and detects the changes in correct branch and schedules only that  job.
But with the post-receive hook, my both jobs are getting scheduled . I don't want that. If the changes are pushed to master, I want only job configured for master branch should be scheduled or changes are pushed to release i want only job configured to release branch should be scheduled. 

How can i do this? Can anyone help me to resolve this issue? 


Thanks,
M

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: post receive commit is causing all the jobs to be triggered

Maneesh M P
Ok I figured ths out, we pass branch name along with URL


Thanks,
Maneesh

On Saturday, April 5, 2014 3:21:55 PM UTC-7, Maneesh M P wrote:
Hello,

   I have a jenkins + git build environment . Currently my builds are configured to poll for scm changes in every 5 minutes, if it detects a change, builds gets triggered.  To get rid of the scm polling, I have configured a post-receive git hooks.

I have the below command inside the hook,

 curl <a href="http://jenkins.abc.com:8081/git/notifyCommit?url=git@gitserver.abc.com:test-repo.git" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjenkins.abc.com%3A8081%2Fgit%2FnotifyCommit%3Furl%3Dgit%40gitserver.abc.com%3Atest-repo.git\46sa\75D\46sntz\0751\46usg\75AFQjCNFdWHvqt6JE2CWA7aUAjmBaJFA_zQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fjenkins.abc.com%3A8081%2Fgit%2FnotifyCommit%3Furl%3Dgit%40gitserver.abc.com%3Atest-repo.git\46sa\75D\46sntz\0751\46usg\75AFQjCNFdWHvqt6JE2CWA7aUAjmBaJFA_zQ';return true;">http://jenkins.abc.com:8081/git/notifyCommit?url=git@gitserver.abc.com:test-repo.git

This works great and it schedules the job if "poll SCM" option is enabled. But the problem is

I have two pipeline jobs, one for master branch and one for release branch. When i configured the Jenkins polling, it polls and detects the changes in correct branch and schedules only that  job.
But with the post-receive hook, my both jobs are getting scheduled . I don't want that. If the changes are pushed to master, I want only job configured for master branch should be scheduled or changes are pushed to release i want only job configured to release branch should be scheduled. 

How can i do this? Can anyone help me to resolve this issue? 


Thanks,
M

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.