Accessing BuildResult files from "Request Rebuild..." action
![]()
I have been able to create a BuildResultPage contributor/provider which displays the files that were published via the build engine.
What I would like to do is also be able to reference those file(s) from within the "Request Rebuild..." action for our custom dialog section. In the Rebuild Dialog there is a reference to the BuildResult, which is not null. What I can't figure out is how to get a IBuildResultContext, which best I can tell is what the ResultPage uses to get access to the files associated with the BuildResult. This is passed to the ResultPage when it is constructed from how I am understanding the build source. Is it possible to do want I am attempting? If yes, what object/methods do I need to get the IBuildResultContext so I can get the contributions using getContributions or is this even necessary? Is there another way of doing what I want too do? |
Accepted answer
2 other answers
![]()
Hi Steve. In the request dialog, sections are contributed via the requestBuildDialogSections extension point.
The built in ones are defined with:
<extension point="com.ibm.team.build.ui.requestBuildDialogSections"> <requestBuildDialogSection class="com.ibm.team.build.internal.ui.dialogs.ScmOptionsSection$Factory" order="100"/> <requestBuildDialogSection class="com.ibm.team.build.internal.ui.dialogs.PropertiesSection$Factory" order="200"/> </extension>
The class given must implement com.ibm.team.build.ui.dialogs.requestbuild.IRequestBuildSectionFactory, and its create method is passed a com.ibm.team.build.ui.dialogs.requestbuild.RequestBuildSectionSite. RequestBuildSectionSite has getTeamRepository(), getBuildResult(), isRebuild() and other methods.
RequestBuildSectionSite is similar to IBuildResultContext in that it provides contextual info from the containing UI, but IBuildResultContext is specific to the build result editor context.
Comments Nick, thanks for the info. I already have a dialog section implemented as part of our solution, which is how our user base will enter our specific build data. We will be displaying our build wizard from this section.
The flow is this:
https://jazz.net/forum/questions/106107/is-there-a-way-to-send-a-file-in-a-buildrequestbuilddefintion-to-the-build-engine?utm_campaign=forum&utm_medium=email&utm_source=forum-new-comment&utm_content=forum-question In the editor context, the editor fetches the contributions of interest for you. In the request dialog, you'd need to do this yourself using:
(there's also a multi-type-id variant).
Use:
to get the client interface. Once you have the IBuildResultContribution item(s), the rest of the processing should be the same as in the result editor extension.
Using contributions in this way could also be used for the other issue of communicating a file to the build. The corresponding API is:
See also:
and the type id constants on com.ibm.team.build.common.model.IBuildResultContribution.
It's a bit odd to contribute a file (actually a content blob) to a build before it's run, but the API doesn't actually check the build state. It'll get cleaned up when the build is deleted too.
You can use the artifactFileRetriever or logFileRetriever Ant task to retrieve the content, depending on the contribution type. Unfortunately we don't have a task that allows an arbitrary contribution type, so if you want to use your own you'd need to write the fetching code yourself.
Nick thanks. So for Rebuild it looks like its possible to get the file from the Result using the solution you provided above.
Sorry, I neglected the fact that we don't actually notify the section extensions after the request has been submitted. The request is submitted in com.ibm.team.build.internal.ui.dialogs.RequestBuildDialog.requestBuildJobImpl(IBuildDefinition, ITeamRepository, IProgressMonitor). Unfortunately, I don't see any way for you to intercept this and get the request or result after it has been submitted, at least not using the standard request dialog. If you have control over the action that brings up the request dialog, you could provide your own subclass and override RequestBuildDialog.requestBuild. Nick, is it possible to add a property to the build result from the build agent running a ANT script? I don't see a way. All I see is the ANT script can only read properties.
showing 5 of 8
show 3 more comments
|