How to change a build property dynamically with RTC SDK
Hello,
I need to alter the build definition workspace dynamically, whenever a build definition is requested. The value is based in a build definition property. I created an adivisor (server-side) to solve this. The problem is that the workspace is changing normaly, but the current request (wich call this advisor) is executing with old workspace value. How to change also the current request value or how to update the current request values? Can anybody help me? |
2 answers
Hi, if you change the properties on a build definition they'll be used for the next build. You need to change the property to the build request instance. I generally start a build from another action and set them there (the requestBuild method have a "NewOrModifiedProperties" parameter). I'm not sure you can do this when the request has already started.
Couldn't you start the build basing on some workflow action? It would be easier to manage this behavior. Comments
Pietro Bottino
commented Apr 20 '16, 2:25 p.m.
In my case, I need to change the build definition workspace whenever a build is requested, and I need to use this new value for the same request.
Pietro Bottino
commented Apr 20 '16, 2:31 p.m.
Really, I'm saving the build definition. I need to save (if possible) the new property value in the current request.
|
I tested to alter the properties from newOrModifiedBuildProperties and worked. Editing this value from newOrModifiedBuildProperties, the current request update the information normally. Below is the my code for this.
private void setWorskpaceBuilProperty(BuildRequestParamsImpl buildRequest, String newValue) { List<IBuildProperty> newOrModifiedBuildProperties = buildRequest.getNewOrModifiedBuildProperties(); IBuildProperty propertyChange = null; for (IBuildProperty iBuildProperty : newOrModifiedBuildProperties) if (iBuildProperty.getName().equalsIgnoreCase(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID)) propertyChange = iBuildProperty; if (propertyChange == null) return; propertyChange.setValue(newValue); } |
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.