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

BuildDefinition Save Event (Advisor or Participant)

 HI All,

   Is there any extension point/operation id for save build definition event?

   I'm trying to validate some build properties and also setting some properties based on others.

    Currently I'm using "com.ibm.team.build.server.requestBuild", but I'm not able to change the build request properties. All that I can do is to retrieve an workingCopy of the build definition, change its properties and save it. Then I have to cancel the request and make a new build request programmatically (which calls the advisor one more time).


Thanks,
Bello

0 votes


Accepted answer

Permanent link
Hi Eduardo, can you describe what you're trying to do at a higher level?  When issuing a build request, the APIs allow overriding the properties specified in the build definition, but it sounds like what you're trying to do is to intercept requests being made by some other client.  Modifying the build definition is probably not the best way to go.

Note that in 4.x, the operation advisor / participant for "com.ibm.team.build.server.requestBuild" are passed a com.ibm.team.build.common.model.IBuildRequestParams instance as the AdvisableOperation's operation data.  With this you could add properties to add/override in IBuildRequestParams.getNewOrModifiedBuildProperties(), to remove in getDeletedBuildProperties(). 
Eduardo Bello selected this answer as the correct answer

0 votes

Comments

 Hi Nick,


    The goal is, when any user make a build request, the advisor will check some information (what kind of build is that BF, Ant...), next it will read some information from a xml file and some information from a given workitem. Then the advisor need to change some of the build properties before send the request.

    I'd thought about two options. a) Make the changes when saving the BuildDefinition or b) Make the changes when a build is request.

    As I didn't find any way to implement option "a", I'm trying "b". 

    But,if you are saying that if I modify the properties in IBuildRequestParams.getNewOrModifiedBuildProperties(), the request will override the original properties, it will work for me. I'll give it a try.

if I modify the properties in IBuildRequestParams.getNewOrModifiedBuildProperties(), the request will override the original properties

Yes, but that would have to be done in an advisor, before the actual operation is run.

Another option is to add a section to the request build dialog in the UI (Eclipse UI only though).  This would also allow for user input if needed.

It worked. I was already running it in an Advisor (op. id: com.ibm.team.build.server.requestBuild).


Now, do you know how can I  be notified if the build ended successfully or with error? 

Good to hear.  The requests to complete a build are also Process-enabled.  That is, operations:

ITeamBuildRequestService.makeBuildComplete(IBuildResultHandle, boolean, String[])
ITeamBuildRequestService.makeBuildIncomplete(IBuildResultHandle, String[])
both run as Process-enabled operations using operation id "com.ibm.team.build.server.buildLifecycle". Unfortunately, they don't pass any info to the Process operation indicating anything about the build in question, so this isn't much use.  The only alternative I see is to periodically poll the builds you're interested in (perhaps the ones that went through your advisor).  Another option is to query for Build change events, but again that would have be run periodically, perhaps as a registered async background task like the build scheduler and pruner.  See the plugin.xml for com.ibm.team.build.service for how these are declared.

A change event polling approach is used in the Build email notification task.  The implementation is in com.ibm.team.build.internal.service.notification.BuildNotifier, in the com.ibm.team.build.service.notification plug-in.  In addition to querying for change events to notify about since the last run, it uses sentinel change events to keep track of when it last ran.


 Hi @nedgar,


   I'm having a little problem. It seems that builds requested within Eclipse client calls "com.ibm.team.build.server.requestBuild" operation id and the Advisor I created. But, if I request the build from Web UI, RESP API or Java Client Libraries, the Advisor is not called. Or at least the advisor is called after BuildForge validation.

  Here is my scenario, I have a Porject on BuildForge that has some "MUST CHANGE" properties. Two of those properties are configured on demand by the Advisor I built. So the steps would be something like this:
 
   1- User fill up a property named "WorkItem ID" then request the build
   2- My java Advisor, read the work item id, searches for it, and fill up the others "MUST CHANGE" properties based on some work item information.
   3- With all properties correctly informed, the request is sent to BuildForge

 All of this works just fine when I made the request from Eclipse client. But if I use Web UI, REST API or even Java Client Libraries, the build request is sent to BuildForge right away and it returns an error that the "MUST CHANGE" properties were not informed. Because the request wouldn't call the advisor.

  What should I use to make a Build Request Advisor that is called when request were called from WebUI?

showing 5 of 6 show 1 more comments

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,938
× 562
× 51

Question asked: Feb 12 '14, 11:50 a.m.

Question was seen: 5,779 times

Last updated: Apr 16 '14, 1:45 a.m.

Confirmation Cancel Confirm