Skip to main content

Workspace Variables

Substitution Rule

Variable can be inserted into various fields of workspace spec by surrounding with @. The list of available variables will be prompted when @ is typed. Below is some examples of variable substitutions (assume project name is foobar):

OriginalSubstituedExplanation
ubuntu-@project_name@ubuntu-foobarcontents enclosed with @ is variable and will be substituted
ubuntu-@@project_name@@ubuntu-@project_name@@@ will be interpreted as literal @
ubuntu-@project_name@@OneDev will complain about invalid variable reference@project_name@ will be interpreted as a variable reference, and the last @ is singled out. The correct form should either be ubuntu-@project_name@@@, or ubuntu-@project_name@@someOtherVar@

Variable Reference

VariableExplanation
project_namename of current project
project_pathpath of current project
spec_namename of current workspace spec
branchgit branch the workspace is working on
workspace_numberserial number of workspace which can be used to reference the workspace
script:builtin:<script name>run specified builtin groovy script and get the result
script:<script name>run specified custom groovy script and get the result