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

Can you get a build definition name from build result UUID?

 I have a tool to update the properties (Last_Run) of a build definition after a completed build. There is nothing preventing teams from creating a build definition of the same name, so ensure we update the properties of the correct definition I would like to use the buildresultuuid to obtain the definition name.  Are there any clues on how this can be done?

0 votes

Comments

What kind of "tool" do you have? Are you programming against the RTC SDK? If so, you may be able to fetch the build definition model from the repository. Otherwise, if you're using some other tool then I don't know.

*Note, I do not work on the build team - so I'm not sure what tools they provide, or whether anything that I would personally attempt in the SDK is sanctioned public api.

Using the java api we created a jar that will update a build definition property.  Currently the tool requires a property that provides the definition name.  I would like to use the build result UUID to dynamically obtain that instead.  As of yet I haven't found a way to do that



2 answers

Permanent link
Well it turns out RTC will prevent multiple build definitions with the same name, even accross project areas.  This is great news, but it would still be nice if I could get the build definition name from the buildresultUUID.  Otherwise, i have to go back and update just over a thousand definitions spread across five rtc instances. 

0 votes


Permanent link
I think something like this might do the trick:

ITeamRepository repo = getTeamRepository();
IItemManager itemManager = repo.itemManager();
UUID buildResultUUID = getBuildResultUUID();

IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(
        buildResultUUID,
        null );
IBuildResult buildResult = (IBuildResult)itemManager.fetchPartialItem(
        buildResultHandle,
        IItemManager.DEFAULT,
        Collections.singletonList( IBuildResult.PROPERTY_BUILD_DEFINITION ),
        null );

IBuildDefinitionHandle buildDefnHandle = buildResult.getBuildDefinition();
IBuildDefinition buildDefn = (IBuildDefinition)itemManager.fetchPartialItem(
        buildDefnHandle,
        IItemManager.DEFAULT,
        Collections.singletonList( IBuildDefinition.PROPERTY_ID ),
        null );

System.out.println( buildDefn.getId() );

0 votes

Comments

this worked perfectly thank you! 

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

Question asked: Dec 12 '12, 11:07 a.m.

Question was seen: 7,431 times

Last updated: Dec 19 '12, 3:17 p.m.

Confirmation Cancel Confirm