Hi,
My Jenkins plugin has one build Wrapper and one builder class . I want to set the PATH variable in setup() method of BuildWrapper and use it on command line directly in Builder class using ProcessLauncher. I am facing the following issues
1) I am setting the PATH using context object of BuildWrapper
@Override
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher,
TaskListener listener, EnvVars initialEnvironment)
throws IOException, InterruptedException {
CommandConstructUtil utils = new CommandConstructUtil(launcher, getLocalMatlab());
// Set Environment variable
setEnv(initialEnvironment);
String nodeSpecificFileSep = utils.getNodeSpecificFileSeperator();
context.env("mytool", getLocalTool());
// Add custom tools bin folder to path to access it directly through command line
context.env("PATH+mytool", getLocalTool() + nodeSpecificFileSep + "bin");
}
2) In Builder class i am trying to launch it like below
matlabLauncher = launcher.launch().pwd(workspace).envs(envVars).cmds("mytool --runCommands")
With above its not able to launch the tool. However i could do that using cmds("/bash/bin -c mytool --runCommands")
Is there any way that i need not prefix the /bin/bash or cmd.exe and access the tool directly? currently, above approach is not working please help .
Regards
Nikhil