I'm trying to set a couple of environment variables in a Jenkinsfile, but my lack of Java/Groovy-ness seems to be failing me...
pipeline {
agent any
environment {
TMPDIR = /mnt/storage/build
TOX_DIR = $TMPDIR/$BUILD_TAG
}
...
Generates 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 variations such as ...
TOX_DIR = "$TMPDIR" + "/" + "$BUILD_TAG"
or
TOX_DIR = "$TMPDIR/$BUILD_TAG"
or
TOX_DIR = "${TMPDIR}/${BUILD_TAG}"
only make matters worse.
What am I missng? Thanks....
In "Manage Jenkins" -> "Configure System" -> "Global Properties" -> "Environment Variables" I added "ALL_NODES_ENVVAR".
Download a binary distribution of Groovy and unpack it into some folder on your local file system. Set your GROOVY_HOME environment variable to the directory where you unpacked the distribution. Add GROOVY_HOME/bin to your PATH environment variable. Set your JAVA_HOME environment variable to point to your JDK.
Using Jenkins v2.89.2 - Instead of using single quotes, double quotes worked for me.
environment{
MESSAGE = "release-staging-${BUILD_TIMESTAMP}"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With