0

I am learning all of these new technologies. I have a home server for private development with latest version of centos 7.6 (minimal installation). I am trying to keep the server as light as possible.

I have installed jenkins (v2.164.2) and it is up and running correctly. I have created a new Freestyle project to compile a g++ project hosted on another own gogs server. I have defined gogs url and credentials and then added the following in the execute shell command:

which g++; make clean; make;

When I press the "Build Now" button, it fails with the following message:

which: no g++ in (/sbin:/usr/sbin:/bin:/usr/bin)

Cloning the repository, etc seems to be working fine.

I have NOT installed the default g++ version but instead I have installed the one that comes with devtools-7 (g++ v7.3.1). I have created a new file under /etc/profile.d/devtools.sh with the following text:

!#/bin/bash
source scl_source enable devtoolset-7

If I login into a bash shell in the server and then run which g++, I get the expected output.

Finally, the question: why jenkins is not picking this up? As far as I know, adding that file under /etc/profile.d ensures that everyone will be able to access g++.

Thanks very much in advance for any help.

Marc
  • 11
  • 4

1 Answers1

1

I have managed to fix it at the end. I leave the question just in case someone else runs into the same problem. I only had to add the following line as first line in the "execute shell" command field:

#!/bin/bash -l
make clean; make;

That #!/bin/bash -l did the trick. (Please mind the -l).

Found it here: What shell does Jenkins use?

Marc
  • 11
  • 4