It's all about the answers!

Ask a question

How do I set the state of a build result created with "BuildItemFactory.createBuildResult()"?


Todd Strangio (52610) | asked Jun 17 '13, 9:33 a.m.
retagged Jun 17 '13, 9:46 a.m. by Abraham Sweiss (2.4k1031)
I've written some Java to create a build result within a specific build definition.  Works OK, however, the newly created build result is created in the 'NOT_STARTED' state, and there doesn't seem to be a 'setBuildState()' method.  How is this accomplished so the build result can be created and set to 'COMPLETED' state?


Accepted answer


permanent link
Spencer Murata (2.3k115970) | answered Jun 18 '13, 9:30 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
 You don't set the state explicitly, you move it through the states through the build request service.  So when you call the startBuildWithoutProcess() or the like, it will move the build to RUNNING.  Then when it is complete you call  makeBuildCompleteWithoutProcess or the like to move it to COMPLETE.  So there is no setState, just lifecycle commands from the request service.

~Spencer
Todd Strangio selected this answer as the correct answer

Comments
Todd Strangio commented Jun 28 '13, 3:01 p.m.

Thanks Spencer, I'm looking into this possibility now. 


Todd Strangio commented Jul 01 '13, 10:08 a.m.

Any chance you can provide an example?  I'm not seeing how to move through the process for a build result created using BuildItemFactory.  Thanks in advance.


Heather Fraser-Dube commented Jul 03 '13, 2:57 p.m.
JAZZ DEVELOPER

Take a look at
 ITeamBuildRequestClient.startBuild(IBuildRequestHandle, String[], IProgressMonitor)
 ITeamBuildRequestClient.makeBuildComplete(IBuildResultHandle, boolean,
            String[], IProgressMonitor)

 For marking a build as abandoned
 ITeamBuildRequestClient.makeBuildIncomplete(IBuildResultHandle, String[],
            IProgressMonitor)

The ITeamBuildRequestClient can be obtained from ClientFactory


Todd Strangio commented Jul 10 '13, 3:29 p.m.

To mark a build result as 'Complete', I first had to claim it. Thanks Heather!

buildRequestClient.claimRequest(IBuildRequestHandle buildRequestHandle, IBuildEngineHandle buildEngineHandle, java.lang.String[] properties, org.eclipse.core.runtime.IProgressMonitor progressMonitor);

One other answer



permanent link
Lauren Hayward Schaefer (3.3k11327) | answered Jun 18 '13, 7:01 a.m.
JAZZ DEVELOPER
Hi Todd,
I have very limited experience with the build api.  I did a little poking around, and it looks like if you use createBuildResult() instead of createBuildResultContribution(), you can call result.setStatus().  I'm not sure if that will work for your situation, but I thought I'd pass that along in case it helps.

Comments
Todd Strangio commented Jun 18 '13, 8:14 a.m.

Appreciate the response Lauren, but I am already using createBuildResult(), and I'm trying to set the build state, which is different from the build status

Your answer


Register or to post your answer.