I am using very short snippet of groovy code in my build step (bash script) to retrieve and set variable. I have a variable defined in configuration which value I can easily retrieve using the short groovy code.
${vars.getValue("var_name")}
If I want to set static string as a new value for this variable I can do it like this:
${vars.get("var_name").setValue("NEW VALUE")}
This static string works OK!!!
But if I want to use in setValue method some other variable which is previously defined in this Step with bash script:
file_name="NEW VALUE"
${vars.get("var_name").setValue($file_name)}
I am getting an error:
ERROR - Step 'master>lin_download_artifactory' is failed: Failed to evaluate below expression in configuration 'root/arena':
mvel:vars.get("var_name").setValue($file_name)
I tried as well:
${vars.get("var_name").setValue(file_name)}
The same** ERROR!**
Can you please tell me how I could reference variable within the setValue method? I tried also setValue(file_name) but it doesn't work as well.
- solved #2
- replies 7
- views 1822
- stars 0