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.

Modifying another build's variable at runtime #3927

kururin ·

Hello!

I have a conf_A with a variable var_A.
Conf_A triggers a conf_B.

From conf_B, I'd like to modify var_A.
I added this script step in conf_B:

def buildManager = system.getBuildManager();
def bld = buildManager.load(build_id_conf_A);
bld.getVar("var_A").setValue("New value!!");
buildManager.save(bld);

The step succeeds but var_A didn't change.

Am I trying to do something not possible?

Thanks!
Mathieu

  • replies 2
  • views 1074
  • stars 0
robinshen ADMIN ·

Build A keeps a copy of all variables used in the build and will write to database after build finishes, your copy will be overwritten. I'd suggest to keep the variable in build B, and read it back in a step following the trigger build in build A and set it to build A's variable.

kururin ·

Great. It works like that.
Thanks for explanations!