Combining environment variables in Jenkins / groovy pipeline
I'm trying to set a couple of environment variables in a Jenkinsfile, but my Java / Groovy -ness flaw seems to be failing ...
pipeline {
agent any
environment {
TMPDIR = /mnt/storage/build
TOX_DIR = $TMPDIR/$BUILD_TAG
}
...
Throws the following error on the console ...
WorkflowScript: 7: Environment variable values can only be joined together with +s. @ line 7, column 26.
TOX_DIR = $TMPDIR/$BUILD_TAG
Other options such as ...
TOX_DIR = "$TMPDIR" + "/" + "$BUILD_TAG"
or
TOX_DIR = "$TMPDIR/$BUILD_TAG"
or
TOX_DIR = "${TMPDIR}/${BUILD_TAG}"
only makes the situation worse.
What am I missing? Thank....
+3
source to share
2 answers