0

I moved jenkins from one server to another and while most things seem to be working I can no longer build on master.

When I run a job on master no bash profile is sourced so I'm missing all my paths. To debug, I setup a slave with the same credentials as master and it works just fine. I get the job to echo the username and machine name and they are the same whether running on "master" or on the slave which is setup on the same machine.

Any ideas on how to get jenkins to source the bash profile when running on master?

EDIT: I just realized that I don't encounter this issue if I launch jenkins from the command line manually. For example, the first command below works, the second doesn't:

$ nohup java -jar "${JENKINS_PATH}" --httpPort=${HTTP_PORT} > ${LOG_PATH} 2>&1 &  # WORKS
$ /sbin/service jenkins start  # DOESN'T WORK

The command to launch jenkins in the startup script is the same as what I'm running on the command line.

James Waldby - jwpat7
  • 8,060
  • 2
  • 19
  • 35
spizzak
  • 877
  • 1
  • 9
  • 16

2 Answers2

0

Should check the setup of your new configuration, like: user/group membership, file-permissions, ...

Can also install (upgrade) Jenkins, which will copy the product's files again and attempt to reconfigure the initialization details.

Gonen
  • 3,625
  • 1
  • 27
  • 36
0

If the job is set up to use Ant then you can put any initialisation in the ~/.antrc file. This is interpreted as if it's a shell script on Linux/Mac. You can do any setup for the paths or other variables by forcing it to read in the initialisation files, eg:

. /etc/profile
. ~/.bash_profile

The reason that it's working for you in the first example is that the java process is being launched from a command prompt which inherits the environment. In the second case it's starting the service which may be run as a different user and with a different environment.

If this method doesn't work then you may find there's a script that gets called when the jenkins service starts. Try man service to find where the configuration files for each service live, and then try forcing the inclusion of the bash profile files as above.

the_mandrill
  • 27,460
  • 4
  • 58
  • 90