It's all about the answers!

Ask a question

How to report Jenkins results to Jazz build engine

Christian Opitz (63412) | asked Jan 04 '16, 10:06 a.m.
Hello all,

we have currently the following setup:
- We are in the process of introducing RTC, but have so far only introduced the change management part.
- currently using SVN for SCM (potentially changing to RTC in future)
- Jenkins for continuous integration and build automation.

As Jenkins is established and working with SVN, and RTC SCM not yet used, I would like to get Jenkins to report the build results to RTC. All manuals and information I have read so far was focussing on using RTC SCM as SCM, and not anything else. This leads of course to using the RTC Jenkins plugin and not the SVN plugin (it is either or).

I have managed to set up RTC and Jenkins in a way that builds can be started from RTC and the results are reported. When starting the build in Jenkins however, RTC seems to not get any information on it. Is there any way to accomplish this by means of a setting, or is it required to create an ANT task to "manually" transfer all the information?


Accepted answer

permanent link
Christian Opitz (63412) | answered Jan 11 '16, 12:14 p.m.
edited Jan 11 '16, 12:38 p.m.
Hello all,

I was not really happy with the fact that it is only possible to
  • either use the RTC SCM configuration and get the information in Jenkins and RTC updated, independent on where you start the build,
  • OR use other SCMs and only have information on both sides when you start the build from RTC, but not when starting from Jenkins

What I did is probably not the nicest thing ever, but it works to have the build status information on both sides, independent from where you start the build. I wrote an Ant script to update RTC. The script is executed after the actual build is finished to get the correct status.

I actually used a 2nd Jenkins job to do this because I did not figure out how to run an ant task as post-build-step, but I am sure it could also be done in this way

All it does is collect the status information and if the build was not triggered from RTC it posts the status and a link to Jenkins to RTC

So here we go:

  1. Create an RTC build engine and definition (in the RTC configuration in Eclipse, see IBM help)

  2. Install the RTC build toolkit on the Jenkins machine
  3. Install Ant on the Jenkins machine
  4. Store the content at the end of the post to a file on the Jenkins machine, e.g. to build.xml
  5. Create a passwordFile according to this description:

  6. Create a new Jenkins job without SCM
  7. Add an Ant build step with the following settings:
    Set the "Ant build file" path to the file just created (build.xml)
    Set the "Target" to
    -lib C:\IBM\TeamConcertBuild\buildsystem\buildtoolkit
  8. Add a post-build step "Trigger parameterized build on other projects" to the job that is actually connected to RTC.
    Set the project to build on the job name of the previously created job
    Set "Trigger when build is" to "Complete" to always run the job
    Add "Predefined parameters" and set to the following to hand over the parameters to the other job

    		rtcBuildDefinitionId=<build definition name>
    		rtcBuildEngineId=<build engine name>


content of the build.xml file:
NOTE: I did not manage to get the content in here without being messed up. I hope it is fairly clear though. Specifically the <br=""> tags do not belong into the file, but they are somehow generated by the forum when posting...

<project name="postResultsToRTC">
        Ant script to post Jenkins build results to IBM CLM

        Parameters to be set for the Ant call
        -lib C:\IBM\TeamConcertBuild\buildsystem\buildtoolkit

        Further parameters to be set (in Jenkins or via -Dxxx in the Ant call)
            jenkinsJobBuildURL - build URL of job to report to ALM
            jenkinsJobDisplayName - displayed name in ALM
            buildResultUUID - buildResultUUID (set in original job)

    <import file="C:\IBM\TeamConcertBuild\buildsystem\buildtoolkit\BuildToolkitTaskDefs.xml" />     <!-- set global properties for this build -->     <property name="userId" value="TODO: Add user name" />
    <property name="thisBuildState" value="nothing" />

    <property environment="env"/>
    <!-- passwordFile is created according to following information: -->
    <property name="passwordFile" value="${env.JENKINS_HOME}\${userId}-password" />
    <property name="tempFile" value="c:\temp\tempBuildState_${env.BUILD_ID}.json" />           

    <echo message="buildResultUUID: ${buildResultUUID}"/>

    <!-- if buildResultUUID was already set, the build was started by IBM RTC (not by Jenkins)
    and no information needs to be posted to RTC as this is done automatically -->
    <condition property="runScript">
            <length string="${buildResultUUID}" trim="true" length="0" />

    <echo if="${runScript}" message="Build was started from Jenkins, information is posted to IBM RTC"/>
    <echo unless="${runScript}" message="Build was started from IBM RTC, no actions are performed. No information needs to be posted to RTC as this is done automatically"/>

    <target name="all" if="${runScript}" >
        <echo message="Transferring build results of previous build to IBM CLM"/>
        <echo message="Please note that this is a temporary solution and has several restrictions. Only a link to Jenkins will be published."/>
        <echo message="Transferring data of the following job: ${jenkinsJobBuildURL}"/>
        <echo message=" the following RTC server:"/>
        <echo message="RTC server address:   ${rtcRepositoryAddress}"/>
        <echo message="RTC build engine:     ${rtcBuildEngineId}"/>
        <echo message="RTC build definition: ${rtcBuildDefinitionId}"/>

        <!-- Tell RTC that a build has started and get the buildResultUUID -->
        <startTeamBuild buildDefinitionId="${rtcBuildDefinitionId}"

        <!-- publish a link in RTC to the build in Jenkins -->
        <linkPublisher buildResultUUID="${newBuildResultUUID}"
            passwordFile="${passwordFile}" />

        <!-- Get Jenkins status of current build. Use API Token for access
             (in Jenkins click on your name in the top right corner and go to settings) -->
        <get src="${jenkinsJobBuildURL}api/json"
            password="<TODO: Add the users Jenkins API Token, not the password itself>"    />

        <script language="javascript">



            var file = new File(postResultsToRTC.getProperty("tempFile"));
            fr = new FileReader(file);
            br = new BufferedReader(fr);

            // Read the file.
            // This assumes the file has no line breaks and is one line.

            var json = br.readLine();

           // Evaluate the JSON.
            var struct = eval("(" + json + ")");

            // Set each property in the project environment.
            echo = postResultsToRTC.createTask("echo");

            // Map state as:
            // - Jenkins status can be SUCCESS or FAILURE
            // - IBM RTC status may be OK, ERROR or WARNING.
            if (struct["result"] === "SUCCESS") {
            else {

        <!-- tell RTC that the build has finished -->
        <completeTeamBuild status="${thisBuildState}"
            verbose="true" />

        <!-- remove temporary file -->
        <delete file="${tempFile}"
Ralph Schoon selected this answer as the correct answer

sam detweiler commented Jan 11 '16, 1:50 p.m.

Very cool.. thank you for posting this info. hopefully it will help others..

3 other answers

permanent link
Bernd van Oostrum (21725471) | answered Jan 04 '16, 10:43 a.m.
When having:
- the RTC SCM-plugin in Jenkins         : here you link to RTC using the field "use a build definition for better RTC integration"
- a "Jenkins Build Definition" in RTC    : here you can refer to your Jenkins-job

you should be able to launch and see the results on both sides. Jenkins will use the RTC Build Toolkit to perform the build.

Christian Opitz commented Jan 04 '16, 12:06 p.m.

This however will only work when selecting and configuring RTC as Source-Code-Management, right? (it is not sufficient to have the plugin installed)

As I am using SVN, this is not working. If I am getting it wrong, please let me know.

sam detweiler commented Jan 04 '16, 12:33 p.m. | edited Jan 04 '16, 12:38 p.m.

No.. you don't HAVE to use JAZZ SCM. its a checkbox on the build definition. just don't check it.

you can still use a Hudson/Jenkins build engine

Bernd van Oostrum commented Jan 05 '16, 3:56 a.m.

@crisop that's right. When using Jenkins-SVN, you're not using the RTC Build Toolkit so there is no default feedback as RTC is not aware about what's happening in the SVN-build.

An idea without guarantee as I never tried it (but which should work)   :
- create a RTC commandline-build where you define your SVN build steps instead of having your SVN-build in Jenkins.
This way you already move the build to RTC while still using SVN as the SCM.

Later, if you want to move your SCM to RTC, this will be interesting:

sam detweiler commented Jan 05 '16, 8:36 a.m.

you can have a build which is a commandline, and NO SCM integration. and the build result will still be pushed back to RTC.  Yes it will not have any SCM content, but that wasn't the question.

Christian Opitz commented Jan 08 '16, 11:46 a.m. | edited Jan 08 '16, 11:48 a.m.

@berndyman: this might work, however, it wouldn't be really nice, because I would lose the possibility to trigger the job based on a SVN commit. The job would have to run regularly without considering any SVN changes. It could only internally check if there were changes and omit further steps, but the job itself would always have to run...

@sdetweil: Sorry, but I don't get your point

sam detweiler commented Jan 08 '16, 12:01 p.m.

All I was saying is that you can have a build, started by RTC, which has NO SCM integration, and its build result will still be recorded back in RTC.

on the prior comment, yes, this is a problem, using the uri to start the build job is not available  if there is no connection between the triggering thing (svn commit) and the build definition.
I built a Deliver hook triggering extension for RTC, similar to the SVN/GIT commit hook, where it runs a script. But that wouldn't solve this problem as there is just no integration with SVN as the triggering system.  you would have to clone and modify the GIT integration commit hook scripts, and probably some of the git server side plugin for RTC server.

showing 5 of 6 show 1 more comments

permanent link
sam detweiler (12.5k6195201) | answered Jan 04 '16, 11:18 a.m.
Unfortunately the results of Jenkins Initiated Builds will not be pushed back to RTC. This is as designed currently..

only builds initiated from RTC will be updated with the build results.

permanent link
Arun Kumar (1129) | answered Dec 14 '17, 12:34 p.m.
edited Dec 14 '17, 12:37 p.m.

I have created a similar structure where I have integrated Gerrit with Jenkins and Jenkins with RTC and
with this once code review is performed in Gerrit, automatically build will trigger in Jenkins and in the job details upon clicking on RTC result option, it will take to RTC page where it will show the build result.

As Gerrit uses GIT as SCM, so I have used source code as GIT and I have created a build definition and build engine in RTC by selecting Jenkins option.

But for me the issue is I can see the build result from Jenkins to RTC and vice versa but it's showing as in progress. Manually I have to run once again build in RTC though it was successful in Jenkins.

Any Idea?


Christian Opitz commented Dec 20 '17, 3:42 a.m. | edited Dec 20 '17, 3:43 a.m.

What do you mean with similar structure? If you are using a similar ANT file as above, make sure to have

<completeTeamBuild .../>

at the end

Arun Kumar commented Dec 20 '17, 11:40 a.m.

I am using Mavan. I have the same issue which has been posted earlier:

sam detweiler (12.3k6158198) | answered Jan 04 '16, 11:18 a.m.

Unfortunately the results of Jenkins Initiated Builds will not be pushed back to RTC. This is as designed currently..

only builds initiated from RTC will be updated with the build results.


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.