Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I update the build status programatically

 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?

0 votes



2 answers

Permanent link
 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.

1 vote


Permanent link
Michael,

if you want to write a custom ant task which interacts with the build object make sure to extend:
com.ibm.team.build.ant.task.AbstractTeamBuildTask
in your Eclipse plugin project rather than the org.eclipse ant task. You can access this when you import the RTC SDK and import com.ibm.team.build.toolkit 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: http://ryehle.wordpress.com/2011/12/21/adding-a-custom-ant-task-to-your-build-toolkit/

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

0 votes

Comments

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.

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

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

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.  

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Sep 30 '14, 6:11 p.m.

Question was seen: 3,437 times

Last updated: Oct 02 '14, 4:24 p.m.

Confirmation Cancel Confirm