Advanced Syntax for Pipeline String Interpolation JENKINS_URL JOB_NAME BUILD_ID Working with the Environment Jenkins Pipeline uses rules identical to Groovy for string interpolation. Groovy’s String interpolation support can be confusing to many newcomers to the language. While Groovy supports declaring a string with either single quotes, or double quotes, for example: Only the latter string will support the dollar-sign ( $ ) based string interpolation, for example: Would result in: Understanding how to use string interpolation is vital for using some of Pipeline’s more advanced features. Jenkins Pipeline exposes environment variables via the global variable  env , which is available from anywhere within a  Jenkinsfile . The full list of environment variables accessible from within Jenkins Pipeline is documented at localhost:8080/pipeline-syntax/globals#env, assuming a Jenkins master is running on  localhost:8080 , and includes: The current build ID, identical to BUILD_NUMBER for builds created in Jenkins versions 1.597+ Name of the project of this build, such as "foo" or "foo/bar". Full URL of Jenkins, such as example.com:port/jenkins/ (NOTE: only available if Jenkins URL set in "System Configuration") Referencing or using these environment variables can be accomplished like accessing any key in a Groovy Map, for example: 35 Hello Mr. ${username} I said, Hello Mr. Jenkins def username = 'Jenkins' echo 'Hello Mr. ${username}' echo "I said, Hello Mr. ${username}" def singlyQuoted = 'Hello' def doublyQuoted = "World"