Skip to content
Permalink
Browse files

[FIXED JENKINS-42381] Add PATH+GRADLE and buildEnvVars(...)

This ensures that Gradle's bin directory ends up on the PATH when
using the Pipeline tool step. Note that Jenkins' environment variable
management will handle converting "/bin" on Windows if needed, we do
not need to do that explicitly.
  • Loading branch information
abayer authored and wolfs committed Apr 2, 2017
1 parent 4060b4f commit 96e82f0a2140f72d8944f3c0435f81537d2f6ae7
@@ -63,6 +63,10 @@ public String getHome() {
return super.getHome();
}

@Override
public void buildEnvVars(EnvVars env) {
env.put("PATH+GRADLE", getHome() + "/bin");
}

public String getExecutable(Launcher launcher) throws IOException, InterruptedException {
return launcher.getChannel().call(new MasterToSlaveCallable<String, IOException>() {
@@ -28,6 +28,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlButton
import com.gargoylesoftware.htmlunit.html.HtmlForm
import com.gargoylesoftware.htmlunit.html.HtmlPage
import com.google.common.base.Joiner
import hudson.EnvVars
import hudson.cli.CLICommandInvoker
import hudson.model.Cause
import hudson.model.FreeStyleBuild
@@ -348,6 +349,11 @@ task hello << { println 'Hello' }"""))
installation.name == 'myGradle'
installation.home == '/tmp/foo'

def envVars = new EnvVars()
installation.buildEnvVars(envVars)
assert envVars.containsKey("PATH+GRADLE")
assert envVars.get("PATH+GRADLE") == installation.home + "/bin"

// by default we should get the auto installer
def props = installations[0].getProperties()
assert props.size() == 1

0 comments on commit 96e82f0

Please sign in to comment.