| Hello, I would like to use my own environment variable to set the customWorkspace. Unfortunately, the customWorkspace seems to resolve only built-in Jenkins variables, like JOB_NAME or JOB_BASE_NAME. See below, the pipeline I am trying to execute:
pipeline {
environment {
CUSTOM_VAR = 'dev1'
}
agent {
node {
label ''
customWorkspace "/var/lib/jenkins/workspace/${CUSTOM_VAR}"
}
}
stages {
stage ('Print CUSTOM_VAR') {
steps {
sh 'printenv'
sh 'echo "$CUSTOM_VAR"'
}
}
}
}
This pipeline is throwing the error: [Pipeline] End of Pipelinegroovy.lang.MissingPropertyException: No such property: CUSTOM_VAR for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63) Thank you! |