tag:blogger.com,1999:blog-6915405415003666702.post6002877529177311098..comments2024-01-10T03:25:01.209+05:30Comments on N Recursions: How to trigger a Jenkins build on git commitNavhttp://www.blogger.com/profile/01320006785676088076noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-6915405415003666702.post-82237883430660605972016-03-13T23:23:14.997+05:302016-03-13T23:23:14.997+05:30Thank you @golfer. I haven't verified the comm...Thank you @golfer. I haven't verified the command yet, but I trust you've posted the right solution. Am also considering copying Vijay, Tom and your contributions to the main post, with attribution. Pending verification though...Navhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-66360934524997398882016-03-12T03:54:17.944+05:302016-03-12T03:54:17.944+05:30sorry, above comment did not format well.
PYTHON ...sorry, above comment did not format well.<br /><br />PYTHON call:<br /><br />call(["curl", "-sS", "-X", "POST", "http://JENKINS_SERVER:PORT/job/JOB_NAME/build"])adiyamanhttps://www.blogger.com/profile/09410978617964307151noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-61812655735088581022016-03-12T03:52:38.547+05:302016-03-12T03:52:38.547+05:30It has to be a POST request as :
from Python :
...It has to be a POST request as :<br /><br />from Python :<br /><br />call(["curl", "-sS", "-X", "POST", "http://<b></b>/job/<b></b>/build"])adiyamanhttps://www.blogger.com/profile/09410978617964307151noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-17659994325308206692015-09-08T00:02:21.352+05:302015-09-08T00:02:21.352+05:30Well Surendra, as you'd already know, polling ...Well Surendra, as you'd already know, polling is not recommended. If you really want it, in Jenkins there is the poll SCM option in build triggers. You could have saved time by Googling it:http://lmgtfy.com/?q=jenkins+poll+for+changes+in+repositoryNavhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-501123137365804522015-09-07T19:49:12.324+05:302015-09-07T19:49:12.324+05:30Hi Navin,
i need small information:I want to do bu...Hi Navin,<br />i need small information:I want to do build on every pull if there are changes @ Java files.could you please suggest.<br />I know in general it is 'post-receive' hook where we do trigger the build.But we dont want to create hooks on remote server.So we poll every 15 mins, and if there is a change in java files we want to trigger build.Surendra Vadlamudihttps://www.blogger.com/profile/11982316703684502543noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-51517423894241777642015-08-06T16:40:43.383+05:302015-08-06T16:40:43.383+05:30@Navin IPE . I am using ubuntu machine, As you sai...@Navin IPE . I am using ubuntu machine, As you said in the first line , will it be different in ubuntu ? Anonymoushttps://www.blogger.com/profile/01044278040981462374noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-49097738648357266422015-06-16T19:32:51.698+05:302015-06-16T19:32:51.698+05:30I had the same problem (Linux,Ubuntu), it was beca...I had the same problem (Linux,Ubuntu), it was because my post-commit file was not writable. A chmod a+x post-commit might be you solutionAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-36451991050380751772015-05-26T22:13:56.818+05:302015-05-26T22:13:56.818+05:30Hi Tom. Thanks for sharing the technique. I haven&...Hi Tom. Thanks for sharing the technique. I haven't encountered this problem on Linux or Windows. Even on asking on a Git forum, nobody responded. They haven't been through such a situation, apparently. <br />https://groups.google.com/forum/#!topic/git-users/WgY6Bce6_hoNavhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-13413050676823959162015-05-07T15:20:17.451+05:302015-05-07T15:20:17.451+05:30I have no sample file "post-commit" too,...I have no sample file "post-commit" too, but you can just create one, it's very simple:<br /><br />#!/bin/sh<br />curl "http://192.168.99.200:8080/job/Test01/build?delay=60sec"<br /><br />save it as "post-commit" and you are done.<br />in windows, you can use for example "start chrome http://www.google.de" to see, if your post-commit works (file is executed afer commit)Tomnoreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-35316993723651038142015-04-15T21:54:49.585+05:302015-04-15T21:54:49.585+05:30@Hariharan: I hope both of you created new git rep...@Hariharan: I hope both of you created new git repositories and searched for the file in that? The .git folder is a hidden folder. If you still did not find it, please ask your question on a Git forum and post back here if you find a solution. My giving you the file won't help.Navhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-27417831141216590562015-04-15T00:20:06.074+05:302015-04-15T00:20:06.074+05:30Just like Bavanasi, I couldn't find a post-com...Just like Bavanasi, I couldn't find a post-commit.sample file too. Could you share yours please, I use a Mac OS X to run Jenkins?Anonymoushttps://www.blogger.com/profile/01617276294056032858noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-91251192132820193672015-04-08T11:44:19.510+05:302015-04-08T11:44:19.510+05:30@Bavanasi: that's odd...the latest version of ...@Bavanasi: that's odd...the latest version of Git also creates the post-commit file. Even bare repositories do. Please ask on the Git forum, as the problem seems to be something else.Navhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-81858294050401770022015-04-07T14:44:33.712+05:302015-04-07T14:44:33.712+05:30I didn't find any sample file named
post-comm...I didn't find any sample file named <br />post-commit.sample in my .git/hooks folder. <br />I am using git version 1.9.1Anonymoushttps://www.blogger.com/profile/01044278040981462374noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-7727596530706577482014-11-16T15:12:06.532+05:302014-11-16T15:12:06.532+05:30Thanks for posting the command for a REST client, ...Thanks for posting the command for a REST client, Vijay. Much appreciated!Navhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-15919983817010228772014-11-15T03:38:11.981+05:302014-11-15T03:38:11.981+05:30curl -X POST http://:/job/job-name-in-jenkins/buil...curl -X POST http://:/job/job-name-in-jenkins/build?delay=0sec --user user:passwordVijay Polsaninoreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-35815544510016902462014-07-14T21:46:45.809+05:302014-07-14T21:46:45.809+05:30Hi Nir. You can use the Parameterized tag plugin h...Hi Nir. You can use the Parameterized tag plugin https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin<br />Use the tag as a parameter.<br />Rather than build on a tag, I would recommend building on every change that is committed to the repository. That's the whole purpose of CI. You can use the Heavy Job Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Heavy+Job+Plugin) to run parallel builds if you're worried about multiple people building too often. Also, remember that everyone on the team is supposed to do a local build with Jenkins before pushing the code to the main repository where the integrated build takes place.Navhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-70375699750836866112014-07-09T01:38:17.784+05:302014-07-09T01:38:17.784+05:30What if i want to trigger a build only when a new ...What if i want to trigger a build only when a new TAG is applied to repository? How do we do that?<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-16827861189774556472014-03-10T21:23:35.845+05:302014-03-10T21:23:35.845+05:30That's a good idea. Thanks for sharing! The po...That's a good idea. Thanks for sharing! The post-commit hook can come in handy though, in situations where a team wants finer grained control on how their builds should get triggered.Navhttps://www.blogger.com/profile/01320006785676088076noreply@blogger.comtag:blogger.com,1999:blog-6915405415003666702.post-44814208568477712552014-02-17T13:50:25.337+05:302014-02-17T13:50:25.337+05:30Hmmmh, if _you_ push changes to a remote repositor...Hmmmh, if _you_ push changes to a remote repository, and if _you_ (want to) trigger the build, it's going to work this way. BUT: typically the receiving repository shall have the 'post-receive' hook (which will trigger the build). You would do this only _once_ on the receiving system. Else everybody pushing to the repository will need to configure such a hook.Anonymousnoreply@blogger.com