2

Git and Github plugins are installed. Git is used to clone the repository (so it works). I don't have any nodes other than the master which handles the builds. Git PATH is specified at /jenkins/configureTools/.

However, I get this error message?

+ bower install
bower semantic-ui-range#*       ENOGIT git is not installed or not in the PATH
Build step 'Execute shell' marked build as failure
Finished: FAILURE

How can I avoid it?

user3002996
  • 329
  • 4
  • 18

1 Answers1

1

The OP created a Jenkins VM in the context of Bitnami Jenkins for Google Cloud Platform, you can check out the section "How to start with Git and Jenkins?"

As described below, that does not work well (the PATH does not include Git on bower operations)

Workaround, proposed by the OP:

Created another Jenkins VM, this time not using the Bitnami Jenkins.
It works out of the box.


Original answer.

Regarding bower, check bower issue 972

had to go into /bower/lib/core/resolvers/GitResolver.js and comment out the line that checks if Git is there to get this to work. It seems that the which module isn't working correctly for me.

Commented out line:

if (!hasGit) {
     throw createError('git is not installed or not in the PATH', 'ENOGIT');
}
  • Bower: 1.7.7
  • Node: 5.9.0

More generally:

You need to make sure:

  • Jenkins global settings has a Git PATH defined
  • the slaves have a Git installed at that PATH

Example:

https://i.stack.imgur.com/8wO20.png
(Source: "Jenkins path to git Windows master / Linux slave")

That way, you don't depend on the PATH environment variable (on the master or the slaves), as Jenkins will complete it with the Git path defined.

Just in case the slave is executed with a different account (and different PATH), try (if your current PATH does include git) to make that path available to all users (for testing):

echo "PATH=$PATH" | sudo tee /etc/environment
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Jenkins has a global setting with a Git Path in the /jenkins/configureTools/ screen. I don't have any nodes except the master, so I guess the builds are performed at the master (which already has the git in the PATH). – user3002996 Jul 08 '17 at 15:23
  • How Jenkins is launched? Is it with the system account? Because if it is, it does not have the same PATH. – VonC Jul 08 '17 at 15:24
  • I don't know to be honest. I have used Bitnami image to spin it up on google app engine. Also I have just used Script Console on the master node and executed "println System.getenv("PATH")", which gave me this output "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games". Let me know if it makes sense. – user3002996 Jul 08 '17 at 15:27
  • Check the Jenkins system information page, the should be the environment variables listed in there. – VonC Jul 08 '17 at 15:29
  • Under the Environment Variables section there are listed: GIT_EXEC_PATH /opt/bitnami/git/libexec/git-core/ GIT_SSL_CAINFO /opt/bitnami/common/openssl/certs/curl-ca-bundle.crt GIT_TEMPLATE_DIR /opt/bitnami/git/share/git-core/templates – user3002996 Jul 08 '17 at 15:30
  • Yes, but is the PATH listed as well, and does it include the path mentioned in the git_exec_path? – VonC Jul 08 '17 at 15:31
  • PATH: "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games". So it is not present! That's interesting, how can I include it? – user3002996 Jul 08 '17 at 15:33
  • It depends how it is launched. A good first step is to make sure your .profile does declare the right path. – VonC Jul 08 '17 at 15:35
  • @user3002996 Just in case, I have edited the answer and included the official "Bitnami Jenkins for Google Cloud Platform". – VonC Jul 08 '17 at 19:09
  • I have executed the command `echo "PATH=$PATH" | sudo tee /etc/environment` on the vm with jenkins. Sadly the build still fails with `ENOGIT git is not installed or not in the PATH` – user3002996 Jul 09 '17 at 01:10
  • I have checked the suggestion and based on the complexity I have decided to backtrack. Created another Jenkins VM, this time not using the Bitnami Jenkins. It works out of the box... I would like to ask what I should do with this question now. Should it be closed? Deleted? – user3002996 Jul 09 '17 at 23:42
  • @user3002996 No need to delete: I have rewritten the answer to make it clear you were using GCP (Google Cloup Platform), and to make your workaround more visible. That will help others. – VonC Jul 10 '17 at 04:35