for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView()) ec.buildEnvironmentFor(this,env,listener);
for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView()) ec.buildEnvironmentFor(this,env,listener);
for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView()) ec.buildEnvironmentFor(this,env,listener);
for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView()) ec.buildEnvironmentFor(this,env,listener);
/** * Return all job related vars without executor vars. * I.e. slave is running in osx, but docker image for shell is linux. */ protected static EnvVars getEnvVars(Run run, TaskListener listener) throws IOException, InterruptedException { final EnvVars envVars = run.getCharacteristicEnvVars(); // from run.getEnvironment(listener) but without computer vars for (EnvironmentContributor ec : EnvironmentContributor.all().reverseView()) { // job vars ec.buildEnvironmentFor(run.getParent(), envVars, listener); // build vars if (ec instanceof CoreEnvironmentContributor) { // exclude executor computer related vars envVars.put("BUILD_DISPLAY_NAME", run.getDisplayName()); String rootUrl = Jenkins.getInstance().getRootUrl(); if (rootUrl != null) { envVars.put("BUILD_URL", rootUrl + run.getUrl()); } // and remove useless job var from CoreEnvironmentContributor envVars.remove("JENKINS_HOME"); envVars.remove("HUDSON_HOME"); } else { ec.buildEnvironmentFor(run, envVars, listener); // build vars } } return envVars; }