Modify an existing RTC Build Result in Jenkins
- Stage: Team Concert plugin fetches the source and allocate it in a dynamically assigned workspace.
- Stage: Our custom plugin for Jenkins builds the source fetched above.
- Stage: Few tests are executed and reports, artifacts and logs are published to the Build Result via RTC ANT tasks.
Then, the last stage fails because of the following:
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.BUILD FAILED C:\Jenkins\pipeline\build_5\publisher_2014-10-07_17-14-07:4: com.ibm.team.build.common.TeamBuildStateException: 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.
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
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.
Comments
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:
- 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.
- 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.
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
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 https://jazz.net/library/article/807 . 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.