Skip to content

Instantly share code, notes, and snippets.

@t3knoid
Last active February 13, 2018 22:32
Show Gist options
  • Save t3knoid/b255ee97377067c1ccfc026f0aa1d678 to your computer and use it in GitHub Desktop.
Save t3knoid/b255ee97377067c1ccfc026f0aa1d678 to your computer and use it in GitHub Desktop.
Jenkins Groovy script to return build environment variables
// This does not work if Use Groovy Sandbox is enabled
// Execute this as a system Groovy script in Jenkins
def thr = Thread.currentThread()
def build = thr?.executable
def env = build.parent.builds[0].properties.get("envVars")
env.each{
println it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment