In Hudson – Get Project Specific Environment Variables

Interestingly I was able to get the environment variables for a build which could be useful for others that need to be able to get at the Hudson specific environment variables:

1
2
3
def job = hudson.model.Hudson.instance.getItem("JobToGet")
def envVars= job.lastBuild.properties.get("envVars")
println envVars["ANT_OPTS"]