It's all about the answers!

Ask a question

Modify an existing RTC Build Result in Jenkins

Rafael Rezende (431723) | asked Oct 07 '14, 1:32 p.m.
edited Oct 08 '14, 5:00 a.m. by Ralph Schoon (63.0k33645)
I'm implementing a prototype of a Delivery Pipeline using RTC and Jenkins with the following flow:
  1. Stage: Team Concert plugin fetches the source and allocate it in a dynamically assigned workspace.
  2. Stage: Our custom plugin for Jenkins builds the source fetched above.
  3. Stage: Few tests are executed and reports, artifacts and logs are published to the Build Result via RTC ANT tasks.
RTCBuildResultUUID, repositoryAddress and workspace variables are passed from the 1st to the last stage.

Then, the last stage fails because of the following:
C:\Jenkins\pipeline\build_5\publisher_2014-10-07_17-14-07:4: Unable to "start" build activity with label "Publishing" because the build with ID "_8Aa-sU4zEeSmjKA9BakEKQ", build definition ID "Pipeline BD", label "#5" is in the "COMPLETED" state.
I assume it happens because the same Team Concert plugin that generated the RTCBuildResultUUID (build triggered by Jenkins) reports the result back to RTC and completes it automatically. Therefore, the last stage isn't able to modify it anymore.

So, is there any workaround to modify the Build Result or, at least, keep it open when the 1st stage finishes until the last stage completes it by itself?

Accepted answer

permanent link
Heather Fraser-Dube (4512) | answered Oct 08 '14, 10:22 a.m.
There is a 1 to 1 mapping between a Jenkins build and an RTC Build result. It looks based on the article that you are setting up several builds which are triggered after the first build completes. When the first build completes the RTC Build result associated with it will be marked as completed (the plugin will do it if the build is initiated within Jenkins, RTC's integration will do it if the build was initiated within RTC). If a triggered build then tries to create an activity on the RTC build result, it will fail because the RTC build result is already completed.

As Ralph says some things can be done after the build is completed, but creating an activity is not one of them (its like trying to say the build is starting this work, when its already finished so how can it start something).

Unfortunately I have no ideas on how to keep the result open. Only thing I can think of is to create and manage the lifecycle of a build result in your jobs.
Rafael Rezende selected this answer as the correct answer

Rafael Rezende commented Oct 15 '14, 9:43 a.m.

Hi Heather,
If I understood, your answer confirms that the Team Concert plugin is completing the build on its own. The info about the 1:1 mapping is interesting.
So, I can think of two options here:

  1. Use a dedicated Build Definition for the first stage (because it uses Team Concert plugin for loading the source), and another Build Definition for the overall build, which will cumulate results (artifacts, logs..) after every stage. This would be started in the first stage and completed in the last one, using Ant Tasks.
  2. Use a single Build Definition and get rid of the Team Concert plugin. In this case, a build would start in the first stage and complete in the last one, as in the option above. The difference, though, is that it should handle the Team Concert plugin features (accept/load/etc...) via Ant tasks.
The 2nd option seems more "professional" (organized, whatever..), but I'm concerned about losing the benefits of the Team Concert plugin for Jenkins, which I assume has a stronger integration. In this case, do you know if I could implement the all the functionality of the Team Concert using only Ant Tasks?

Rafael Rezende commented Oct 30 '14, 9:49 a.m.

As said, the Team Concert plugin completes the build on its own.

As a temporary solution, I added a flag (also a checkbox in the interface) directly in the plugin to keep it open after the build. This way I can write additional activities and publish artifacts/logs etc from successive builds without any problem.
At the very end, I can simply use an Ant task to complete the Build Result, for instance.

It's very likely that such solution will die soon, because we shouldn't just branch an existing official plugin. However, if you think it could be interesting to merge it back, let me know.

One other answer

permanent link
Ralph Schoon (63.0k33645) | answered Oct 08 '14, 5:59 a.m.
edited Oct 08 '14, 6:00 a.m.

I am not sure what goes wrong and I have no setup to even begin probing. However I did publish to completed builds and worked with them. See . So in general it is possible to do something with the builds after they are completed. You can also still link work items for example.

I am wondering if the fact that the build is marked as completed in RTC before the Jenkins steps are performed is really caused by a problem with the setup. I think Jenkins is really leading the build and should actually close it, not the JBE.

Your answer

Register or to post your answer.