It's all about the answers!

Ask a question

How to change a build property dynamically with RTC SDK


Pietro Bottino (35715) | asked Apr 20 '16, 10:14 a.m.
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



permanent link
Michele Pegoraro (1.8k14119103) | answered Apr 20 '16, 11:03 a.m.
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.

Is there a way to do this, for the same action (request build)?


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.

Is it possible to do this?


permanent link
Pietro Bottino (35715) | answered Apr 22 '16, 8:23 a.m.
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


Register or 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.