It's all about the answers!

Ask a question

Jenkins polling is too slow, can RTC notify Jenkins immediately?


Christian Höltje (5810) | asked Nov 01 '13, 5:17 p.m.
retagged Nov 04 '13, 11:18 a.m. by Scott Cowan (966310)
 I'm using Jenkins LTS + the new Team Center plugin.

The shortest you can set polling to is 5 minutes before Jenkins complains. You can actually set it to once a minute, but that is too slow for fast-feedback.  Builds should start the instant they are delivered.

How can I get RTC to notify Jenkins of changes the instant they happen?

Accepted answer


permanent link
Scott Cowan (966310) | answered Nov 04 '13, 11:17 a.m.
JAZZ DEVELOPER
Here is a work item capturing this requirement that you can subscribe to, HPI: Trigger Jenkins build on SCM changes (rather than polling) (246734).
Christian Höltje selected this answer as the correct answer

8 other answers



permanent link
sam detweiler (12.5k6195201) | answered Nov 02 '13, 8:37 a.m.
RTC and Jenkins are loosely coupled, with polling as the integration technique. There is no live triggering available in the current released products.  

We always had more builds than build servers, so there was always a queue of builds to work on. sometimes the current build would be seconds, sometimes it would be an hour.

Comments
Christian Höltje commented Nov 02 '13, 4:54 p.m.

All I need is a way for Jazz SCM to run a script, or something when a change comes in.


You may have more builds than build servers, but we don't.  Our many jobs build fast and we rarely have any builds queued in Jenkins.  The delay waiting for a build to kick off to verify a changeset is too long.


sam detweiler commented Nov 02 '13, 5:23 p.m.

understood.. the current RTC code does not trigger immediately.


Spencer Murata commented Nov 04 '13, 9:44 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

You could script the checkin/deliver and the build start together using the Jazz SCM CLI and the RTC build Ant tasks. 


~Spencer


Christian Höltje commented Nov 04 '13, 9:49 a.m.

Does that mean "cannot" or that nobody has figured out how yet?


sam detweiler commented Nov 04 '13, 9:49 a.m.

correct, you CAN develop and support your own mechanism.


permanent link
Christian Höltje (5810) | answered Nov 04 '13, 9:55 a.m.
 I see this has been asked before (I didn't find it because I didn't search for "hooks"): https://jazz.net/forum/questions/76612/post-commit-hook-in-rtc

Greg Pflaum's answer looks like it might work, but I'll have to figure out how to write the Java (I'm not a Java expert).

permanent link
sam detweiler (12.5k6195201) | answered Sep 11 '14, 11:35 a.m.
has anyone completed this?

if the plugin launches a script (like the git/svn post-receive/commit hooks..) 
would need to configure WHERE the script lives.. as you probably don't want it in the web server directory tree..

there are a couple REST methods for invoking Jenkins jobs..  with and without extra parameters.

from the no parameters way http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
with parmeters way https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build



permanent link
sam detweiler (12.5k6195201) | answered Sep 13 '14, 1:54 p.m.
edited Sep 14 '14, 10:50 a.m.
so I think a generic RTC deliver hook could get this data

repo_url
project name
stream name
component name
changeset UUID
action string = either 'Baseline' or 'Changset'

the configuration would provide 1 xml line to the process xml for this participant
<DeliverHook script_name="full path to hook script" />

the hook will run under the OS default shell..
on *ix systems this can be specified on line 1  of the script. with
          #!/bin/bash or #!/bin/perl or whatever 
in windows this would be cmd.exe

Edit:  I have this working.. anyone wants to try it send email to my gmail sdetweil

Comments
Martin Dam Pedersen commented Oct 30 '14, 9:47 a.m.

 How do you handle the case, where you deliver multiple changesets in one deliver operation? Is the action string parameter then a list of changeset UUID's.


sam detweiler commented Oct 30 '14, 10:09 a.m.

the current code calls the hook script for each changeset or baseline,
similar to what happens with git or svn calling the post-receive/post-commit for each revision


permanent link
Rafael Rezende (431723) | answered Nov 03 '14, 5:22 a.m.
edited Mar 10 '16, 11:41 a.m.
Hello Christian,
In case you are still looking for an alternative, there is a non-official solution implemented by Jorge Diaz in the link below:
http://jorgediazblog.wordpress.com/2013/01/24/rtc-build-on-deliver-participant/

It works like a charm right out of the box. Simply add this plugin to the RTC server, and configure the triggers using the XML template Jorge provided in there. Whenever a new delivery is made, the chosen build definitions will be immediately triggered.

Jorge mentions that "the code is experimental", but I haven't found any undesired side-effect so far...
Hope it helps!

Edit (10.03.2016):
This plugin works like a charm to trigger the builds, but any queued builds will always build the latest state of the Repository Workspace when they come to the Jenkins executor! That means, only use this feature if your environment has no queues at all! Check my comment at the end of the post.

permanent link
sam detweiler (12.5k6195201) | answered Mar 31 '15, 8:35 a.m.
edited Mar 31 '15, 8:59 a.m.
my DeliverHook plugin is available here
https://www.dropbox.com/s/wus9574yoj705pl/DeliverHook.zip?dl=0

see the contents for the xml config, and the  sample scripts,
windows, linux and perl.

this supports triggering the jenkins job, where the one Rafael mentions triggers the Build Definition
same thing, just different sides of the same process.

this triggering process is functionally identical to the SVN and GIT receive and post_receive hooks.
the scripts link to the jenkins info

this is all developed on my personal time and equipment.

permanent link
paul nusbaum (1349) | answered Mar 10 '16, 10:05 a.m.
Going back awhile here but wondering if there are updated links for the two scripts mentioned in this thread.. I am trying to find a way to add automation to Jenkins builds via RTC (4.0.5 but about to upgrade to 6.0.1). 

I presume RTC still does not include this functionality in more recent versions so thought i'd check if the scripts mentioned here were still available.
thanks!

Comments
sam detweiler commented Mar 10 '16, 10:10 a.m. | edited Mar 10 '16, 10:14 a.m.

I just checked mine (Deliverhook) and it (the download) works correctly

correct.. the product does not include automatic job invocation (still)


permanent link
paul nusbaum (1349) | answered Mar 10 '16, 10:27 a.m.
Disregard - it looks like (unfortunately) both link are blocked in my office, so i'll try from home later.  :)

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.