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?
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.
Couldn't you start the build basing on some workflow action? It would be easier to manage this behavior.
Comments
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.
Is there a way to do this, for the same action (request build)?
Really, I'm saving the build definition. I need to save (if possible) the new property value in the current request.
Is it possible to do this?
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);
}