Setting PATH variable in BuildWrapper

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting PATH variable in BuildWrapper

Nikhil Bhoski
Hi ,

I want to set the PATH variable during setup() of BuildWrapper. and use the tools for which i am setting path directly on command line during my build step (Builder class). I am trying to set the env variable using below in setup() method of Build Wrapper

initialEnvironment.put("mytoolRoot", getMytoolRoot + nodeSpecificFileSep + "bin");
initialEnvironment.override("PATH+mytoolRoot",initialEnvironment.get("mytoolRoot") );

and then just to test i am calling my tool through command line directly using Launcher in same setup() method like below 

launcher.launch().cmdAsSingleString("mytool -batch -ver").env(initialEnvironment).stdout(listener).join();

above command fails to pick up the tool directly through the command line. and the build fails with error Cannot run program "mytool" no such file or directory. 

what can i do to set the env variable . the other option i am trying is to write batch and shell script file and execute it. but i am not sure if i should do that. 

Thanks & Regards
Nikhil 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/d23913f5-daa3-4015-8f90-39e23b66e9b3%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Setting PATH variable in BuildWrapper

Nikhil Bhoski
Any help on this would be appreciated  

On Monday, 20 January 2020 12:17:33 UTC+5:30, Nikhil Bhoski wrote:
Hi ,

I want to set the PATH variable during setup() of BuildWrapper. and use the tools for which i am setting path directly on command line during my build step (Builder class). I am trying to set the env variable using below in setup() method of Build Wrapper

initialEnvironment.put("mytoolRoot", getMytoolRoot + nodeSpecificFileSep + "bin");
initialEnvironment.override("PATH+mytoolRoot",initialEnvironment.get("mytoolRoot") );

and then just to test i am calling my tool through command line directly using Launcher in same setup() method like below 

launcher.launch().cmdAsSingleString("mytool -batch -ver").env(initialEnvironment).stdout(listener).join();

above command fails to pick up the tool directly through the command line. and the build fails with error Cannot run program "mytool" no such file or directory. 

what can i do to set the env variable . the other option i am trying is to write batch and shell script file and execute it. but i am not sure if i should do that. 

Thanks & Regards
Nikhil 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1f09da5a-3805-476a-bbb2-af458b5560e8%40googlegroups.com.