It's all about the answers!

Ask a question

How can I update the build status programatically

Michael West (1611) | asked Sep 30 '14, 6:11 p.m.
 I am writing an ant task to update the build status (OK, WARNING, ERROR) based on certain properties that are set in the build. I only want to set the status.

My code set a BuildStatus object to OK, WARNING or ERROR. then sets the IBuildResultContribution to the status using setStatus(). At this point I'd like to add the the contribution but Ant fails when I do. It looks like I have to set the contribution type ID as well.

However I'm not publishing an artifact here, I just want to set the build status. Is there a way to do this programatically or am I going about it all wrong?

2 answers

permanent link
Arne Bister (2.6k12832) | answered Oct 01 '14, 11:48 a.m.

if you want to write a custom ant task which interacts with the build object make sure to extend:
in your Eclipse plugin project rather than the org.eclipse ant task. You can access this when you import the RTC SDK and import as a binary Eclipse project in your workspace.

Simply export the plugin and drop it into your build toolkit folder to access the custom ant task in your ant script. There is a good article in a blog on this:

If this answers your question please mark it as accepted.
- Arne

Michael West commented Oct 01 '14, 1:56 p.m.

Thanks for the information Arne. I was following an example that was given to me that used a subclass of Task. I'll make the  change.

I do have my original question though. Can I update the build status without setting a contribution type ID? If not what should the Id be? I'm not trying to publish an artifact here just set the status.

Thank you.

sam detweiler commented Oct 01 '14, 2:42 p.m.

can I ask what you are trying to accomplish by updating the status?

sam detweiler commented Oct 01 '14, 2:45 p.m.

can I ask what you are trying to accomplish by updating the status?

Michael West commented Oct 01 '14, 2:58 p.m.

Our build includes a static analysis step. Depending on the number and severity of violations we want to set the build status to OK, WARNING or ERROR.  

permanent link
Michael West (1611) | answered Oct 02 '14, 4:24 p.m.
 I think I found my answer @ this question
I believe we used to support that in the BuildResultPublisherTask but tookit out because it had no tracibility to what actually caused the warningstate causing confusion. We switched to a model where the variouspublishers would support it so that the state could be tied to the actualcontribution causing the problem. If you look at any of the tasks thatextend from AbstractContentPublisherTask(ArtifactFilePublisherTask,FilePublisherTask, LogPublisherTask, etc) they all support a "status"attribute in the task where you can pass in one of "ERROR, WARNING, INFO,OK" so that a connection is made between the offending contribution and thestatus.
So I'll publish the static analysis report xml with the build status set.

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.