Sid06
Sid06

Reputation: 75

How to make Jenkins use already existing environment variables set on a slave node?

I am making use of a batch script that is supposed to run on a slave node, which makes use of Sahi. The environment variable for Sahi is set as 'SAHI_HOME' on the node. When I run the batch I figure out, it is not able to locate Sahi classes. How do I enforce Jenkins to make use of environment variables set on the slave? I mean is there any way to fetch environment variables set on a slave node?

Upvotes: 2

Views: 3672

Answers (2)

globalworming
globalworming

Reputation: 767

We got around this issue by installing and updating Sahi automatically. There is a nice Jenkins Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Custom+Tools+Plugin You just need to place a Sahi Zip somewhere for Jenkis to access. The custom tool plugin automatically unpacks archives and creates a toolname_HOME environment variable. Just name your tool SAHI and you have Sahi and $SAHI_HOME on every job and node you need.

Regards Wormi

Upvotes: 3

Peter Schuetze
Peter Schuetze

Reputation: 16305

I ran into a similar issue with my AIX slaves. The issue is that the .profile file is not executed when a non-interactive shell is started. Therefore, you have several options.

  1. Make sure that the environment variable is set in the environment file (in AIX, I can set the ENV variable to a filename that will be executed for both interactive and non-interactive shells.) I think the .kshrc file might qualify too.
  2. Set the environment variable in the node configuration
  3. set the environment variable in the master configuration
  4. set the environment variable in the job (needs env inject plugin)
  5. set the environment variable explicitly in the bash script

Upvotes: 0

Related Questions