It's all about the answers!

Ask a question

"Build only if there are changes accepted" not working with Jenkins plugin


Rick Patterson (4045) | asked Jul 25 '14, 10:53 a.m.
JAZZ DEVELOPER

Hi.

In the RTC Build Definition, I select "Build only if there are changes accepted", but it seems to always build.  How can I get the build done through Jenkins and the Team Convert Plugin to respect this setting?

I am using:
Jenkins ver. 1.554.3 on Windows,
Team Concert Plugin 1.1.8
Build System Toolkit=4.0.4.0-RTC-I20130803-2156

I allow Build Definition to schedule the build, which is how the build is started.  The build definition uses a Build Engine that directs the build to Jenkins. Jenkins uses a slaves to do the build via the Team Concert Plugin.


In the Jenkins console log during the source fetch stage, I see:

RTC : checkout...
RTC : Build initiated by request from RTC
RTC Checkout : Source control setup
RTC Checkout : Accepting changes into workspace "bddpmtestjava_main_bddpmtestjava_bibld" ...
RTC Checkout : Deleting fetch destination "D:\monaco\bddpmtestjava\bddpmtestjava_main\winx64h\src" before fetching ...
RTC Checkout : Fetching files to fetch destination "D:\monaco\bddpmtestjava\bddpmtestjava_main\winx64h\src" ...
RTC Checkout : Fetching Completed


It does not show show that it fetches any changes.  I dump the environment in my build, and I see these settings:  The first item should likely be true, no?

team_scm_buildOnlyIfChanges=false
team_scm_acceptBeforeFetch=false


Comments
sam detweiler commented Jul 25 '14, 11:38 a.m.

can u post the setting in your build def?  mine looks like this

you could also dump the attribute
team.scm.changesAccepted as noted in the text above


Rick Patterson commented Jul 25 '14, 12:12 p.m.
JAZZ DEVELOPER

Hi.

Yes, those are the settings I have in my RTC build definition that you show above.

Here is part of the env of the job that ran:  (I see in my original post I posted 2 variables that were showing false, I managed to not copy the right log.   The correct log of these entries is below, showing the settings as true, are the ones I meant to put into this question.)

requestUUID=_xvOtMBQTEeSmR-OeB3B5Jg
scheduledBuild=true
team_scm_buildOnlyIfChanges=true
team_scm_workspaceUUID=_gJhnsMsKEeOw7qhcjnOpwg
team_scm_deleteDestinationBeforeFetch=true
team_scm_createFoldersForComponents=true
team_scm_fetchDestination=src
team_scm_componentLoadRules=component=_KAyLwMsGEeOw7qhcjnOpwg fileitem=_ir4MgMsGEeO_wLgq8Ym4AA
team_scm_acceptBeforeFetch=true
team_scm_snapshotUUID=_zxEpIBQTEeSmR-OeB3B5Jg
team_scm_includeComponents=false

I don't see the team_scm_changesAccepted variable, indicating there were no changes accepted (according to the documentation), but the build still continues on instead of quitting.


sam detweiler commented Jul 28 '14, 10:28 a.m. | edited Jul 28 '14, 11:01 a.m.

sounds like you haven't configured the jenkins build properly..


the RTC plugin provides the environment variable..
| apparently the plugin doesn't export this token (on version 1.1.3)
| so the rest is not possible

and you would have to
change your job step to a conditional job step and check for the presence of the
team_scm_changesAccepted attribute. and only compile if present.
(you will need the jenkins conditional job step plugin)

Accepted answer


permanent link
Heather Fraser-Dube (4512) | answered Jul 28 '14, 8:20 a.m.
JAZZ DEVELOPER
There is an enhancement Enhance Hudson/Jenkins server-side integration to cater for SCM Build check
This would have the server look for changes if this flag is set and its a scheduled build prior to sending the build to Jenkins.

The other option is to use Jenkin's scheduling mechanism to start the build. Jenkins supports polling scheduling. Based on the scheduling Jenkins will ask the Team Concert plugin if there are changes and if the answer is yes, it will start the build.
Rick Patterson selected this answer as the correct answer

2 other answers



permanent link
Rick Patterson (4045) | answered Jul 28 '14, 11:44 a.m.
JAZZ DEVELOPER
Thanks, Sam & Heather for your responses. 

Sam - if the method you suggest were to be done, I think there'd be a Jenkins job created for every build attempt, since the job would have to be running before the job itself determines that there are no sources changes to carry on building with.    I guess that would be okay, but I am hoping to only see Jenkins job that actually run after it is determined that there are source changes to build.

Heather - I am able to get my job started conditionally now, depending on whether there are SCM changes.   Thanks! I see there is  an "Rational Team Concert (RTC) Polling Log" link created - it seems to how the results of only the very last poll, so its hard to see a log of the when all the recent polls were done.  Maybe the polling could be enhanced to show the last few polls something or something like that? Perhaps all of today's polls for example, or maybe the last 10 polls, etc. 

Also, just to confirm that the correct workspace is being referred to, perhaps the RTC information about what is actually being polled for changes should be included in the log, i.,e,. at least the work space name, perhaps the server url, and possibly the credentials being used, just in case there are problems.

Comments
Heather Fraser-Dube commented Jul 28 '14, 12:19 p.m.
JAZZ DEVELOPER

The polling link is created by Jenkins. The number of polling logs kept is also managed by Jenkins.

The contents are contributed by the Team Concert plugin. We could put more information in there, but keep in mind that we are trying to keep the check as fast as possible since it can be done by a large number of jobs very frequently. So we would not be retrieving/reporting any other info than what is in the Jenkins job configuration already. If you want that, you should make an enhancement request for that to be included.


permanent link
Rick Patterson (4045) | answered Jul 28 '14, 1:47 p.m.
JAZZ DEVELOPER
Ok.

I see that if a build is attempted after a source change, and the build fails, there is no further attempt to do another build at the next scheduled time, since the source changes have now been accepted into the workspace.   Is there a mechanism to keep attempting a build according to the schedule until there is a good build?    In our case, we have builds that are typically scheduled only once a day. If a build fails due to an infrastructure issue (network connection, disk space, tools failure), this might typically be fixed within one day, without a corresponding source change, and then the builds do not have to be manually forced - they will attempt a new build according to their schedule, and assuming the next build goes through, then they will do no more build attempts until the next source change.

Comments
Heather Fraser-Dube commented Jul 28 '14, 3:09 p.m.
JAZZ DEVELOPER

I am not aware of a way of configuring that with an out of the box Jenkins installation. There might be a Jenkins plugin out there that allows you to configure that kind of behaviour.

Your answer


Register or to post your answer.