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.

how do I get a value from another configuration #2244

qbuser ·
I have two configurations 'A' and 'B' at the same level. I want to set root.A variable softwareDeployRoot to the value of root.B's variable deployRoot.

root.A variable 'nameOfSoftwareConfig' is set to 'B'

this is what I entered for the value of variable softwareDeployRoot in root.A:

${system.getConfiguration("root/" + vars.getValue("nameOfSoftwareConfig") ).getVar('deployRoot')}

but the value is not being set.

The value of deployRoot in root.B is set using XMLSlurper to obtain the value from a control file in Archiva.

Is it possible to do what I'm trying to do?
  • replies 2
  • views 1323
  • stars 0
robinshen ADMIN ·
Value of variable will not be interpretated if access from configuration directly. Try below instead to access variable from a fake build:
${groovy:
import com.pmease.quickbuild.model.Build
def fakeBuild = new Build()
fakeBuild.setConfiguration(system.getConfiguration("root/" + vars.getValue("nameOfSoftwareConfig")))
return fakeBuild.getVarValue('deployRoot')
}
qbuser ·
Thanks for the quick response. I wasn't able to get the fake build to work, but I later realized that the value I want will always be available in the last successful build of the other project's activate config. So my problem has been resolved with the following code:

${groovy:
return system.getConfiguration("root/" + vars.getValue("dbSoftwareConfigName") + "/install/activate/DSDC_dev").getLatestSuccessfulBuild().getVarValue('deployRoot')
}

Thanks much!