Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Mar 22, 2012
1 parent 49b75b3 commit 557267f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Expand Up @@ -7,6 +7,7 @@
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.model.Result;
import hudson.scm.SCM;
import hudson.tasks.BuildWrapper;
import hudson.tasks.BuildWrapperDescriptor;
import net.sf.json.JSONObject;
Expand Down Expand Up @@ -58,6 +59,12 @@ public Environment setUp(AbstractBuild build, final Launcher launcher, final Bui
injectedEnvVars.put("WORKSPACE", ws.getRemote());
}

//Add SCM variables if not set
SCM scm = build.getProject().getScm();
if (scm != null) {
scm.buildEnvVars(build, injectedEnvVars);
}

//Get result variables
Map<String, String> propertiesEnvVars = envInjectEnvVarsService.getEnvVarsPropertiesProperty(ws, logger, info.getPropertiesFilePath(), info.getPropertiesContentMap(), injectedEnvVars);

Expand Down
Expand Up @@ -5,6 +5,7 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.*;
import hudson.scm.SCM;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import org.jenkinsci.lib.envinject.EnvInjectLogger;
Expand Down Expand Up @@ -60,6 +61,12 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
variables.put("WORKSPACE", ws.getRemote());
}

//Add SCM variables if not set
SCM scm = build.getProject().getScm();
if (scm != null) {
scm.buildEnvVars(build, variables);
}

//Always keep build variables (such as parameter variables).
variables.putAll(getAndAddBuildVariables(build));

Expand Down

0 comments on commit 557267f

Please sign in to comment.