Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

copying variables between configurations #4497

drdt ·

I have set up a maintenance task that creates child configurations for branch builds on demand (using system.configurationManager.copyAsNew() as described in another thread). So, if someone wants to start building version 1.0, we create a child of the mainline build configuration by copying from a template, use the configuration name as the branch name, and it inherits everything else from the parent.

However, as these things go, we have been making changes to the template, so now I want to automatically apply these changes when someone requests a new build. I see there is no copy/overwrite action. Can you suggest an approach? I really only expect variables to change.

  • replies 2
  • views 173
  • stars 0
drdt ·

I did spend some time reading the ConfigurationSyncStep.java code, but I don't understand what it is doing well enough to adapt the logic.

robinshen ADMIN ·

To copy variables from one configuration to another:

groovy:
def sourceConf = system.getConfiguration("path/to/source");
def targetConf = system.getConfiguration("path/to/target");
targetConf.setVariables(sourceConf.getVariables());
system.configurationManager.save(targetConf);