Get Environment Variables
instance = Jenkins.instance
envVarsNodeList = instance.globalNodeProperties.getAll(EnvironmentVariablesNodeProperty.class).get(0).getEnvVars()
if ( envVarsNodeList == null || envVarsNodeList.size() == 0 ) {
//Handle this case
} else {
myvar = envVarsNodeList['myvar']
}