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 to use environment variable in working directory field #4390

YangKangSung ·

Hi, I wonder how to use environment variable added in container.
for example, I made the below configuration.

Container X (Composition > Sequential)
------ Step A (Shell/Batch Command)
------ step B (Shell/Batch Command)
------------------------------------------

I added one environment variable "project_name" with value "prj_A" in Container X.
and I set working directory to ${project_name} because I want to run shell script under common.
but I got the "mvel:project_name" error message.

I keep trying to find the example code for accessing environment variable in Pre/Post Execute Action but I can't.

Could you help this?

  • replies 3
  • views 1183
  • stars 1
robinshen ADMIN ·

Environment variables defined in container step will be used by all child steps automatically when execute external commands. It can not be used the way as you described above. To achieve want you want, define variable (instead of environment variable) in configuration setting, and then access it in your script or any other places via ${vars.getValue("someVarName")}

YangKangSung ·

Thanks for reply.
I have a difficulty to find the class definition of objects in Script API Reference.
I know ${build.version} can be used. but I can't any member variable of com.pmease.quickbuild.model.Build in popup window.
I can see only Accessible Methods.
Is there any document of all classes to refer?

robinshen ADMIN ·

For instance, if a method getVersion() is defined in build, you can then refer it with build.version or build.getVersion(). That is how groovy works (https://groovy-lang.org/)