Jenkins path to git Windows master / Linux slave
Ensuring "git" in the path of all slaves and master is one good way.
However Jenkins can have multiple installation of git (true for other tools such as jdk, groovy...)
You can configure this from http://server-url/configure
Click on "Add Git" and provide new git with different name and path
You can then "select which git to use" in the "jobs" configuration.
This approach has a positive side effect. It will allow you to use different git client versions (say for testing)
Jenkins Poll SCM (Git) on Windows master / Build on Linux slave
As requested, I'm posting my own answer to the general idea, for mixing Windows/Linux on Master Slaves when working with git. This solution will allow even to run the same job on multiple mix of Windows/Linux slaves as well as won't break Master polling scm:
Whatever you Jenkins Master platform is, configure the default git installation to point to a valid git for that platform. For example, c:\apps\git\bin\git.exe
for Windows. and then configure the custom "Tool Locations" for each node. This way the master will be able to poll git to check for changes and trigger the job on a slave. The Slave will then be capable to clone the git code because it has its custom location for (Git) Default. Steps to configure properly:
- Manage Jenkins > Manage Nodes
- For each node having git location other than the one provided in the "Git installation", do:
- Open node configuration page (Configure icon)
- Check "Tool Locations" if not already checked
- Click "Add"
- Select "(Git) Default" on the dropdown
- Enter the path to the slave node git installation (e.g.
/usr/local/bin/git
) - Save
- Repeat steps 2.1 to 2.5 for each Linux slave the job may run.
Node configuration for the linux slave node should look something like this:
I believe the additional "git installations" are more suitable, as @Jayan mentioned, when you need to have multiple git installations or you need to run, for some reason, a specific version of git for select Jenkins jobs.
Git not in path during build step in jenkins
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 thewhich
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:
(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
Related Topics
Sort Logs by Date Field in Bash
Increase of Virtual Memory Without Increse of Vmsize
How to Forward Localhost Port on My Container to Localhost on My Host
Docker Alpine Executable Binary Not Found Even If in Path
Apache Server Keeps Crashing, "Caught Sigterm, Shutting Down"
Sed: -I May Not Be Used with Stdin on MAC Os X
Renaming a Set of Files to 001, 002,
Unix 'Alias' Fails with 'Awk' Command
How to Check Fips 140-2 Support in Openssl
How to Specify Non-Capturing Groups in Sed
How to Create Opengl Context via Drm (Linux)
Get Link Speed Programmatically
Unix File System: How Are File Names Translated to Disk Sectors
Assembly: Read Integer from Stdin, Increment It and Print to Stdout
Replace String in a File with Value from Another File
Assembler Systime Giving Error on Executing
What Is the Most Efficient and Elegant Way Develop/Debug Linux Kernel