git plugin, git client plugin and git

159 views
Skip to first unread message

Ashish Yadav

unread,
Feb 8, 2016, 1:58:54 PM2/8/16
to Jenkins Users
I am running Jenkins LTS v1.609.3 on CentOS. 

I have the following plugins installed.
git plugin v2.2.7
git client v1.11.0


However, I also have git installed on master and the slaves.

Master - - git version 1.7.12.4
Slave #1- git version 1.8.2.1
Slave #2 - git version 1.7.12.4
Slave #3 - git version 1.8.3.1
Slave #4 - git version 1.8.3.1
Slave #5 - git version 1.8.3.1
Slave #6  - git version 1.7.1
Slave# 7 - git version 1.8.3.1
Slave #8  - git version 1.8.2.1


When a job executes on the master or the slave, which ‘git’ is it using? Is it the version installed on the server or the git client plugin? 
Also, why do I need both the git and git client plugin? Why not just the git client plugin?

Mark Waite

unread,
Feb 8, 2016, 2:11:24 PM2/8/16
to Jenkins Users
The git plugin presents a user interface and implements most of the Jenkins git use cases, including things like choosing which branches to monitor, polling for changes, publishing changes and tags, ignoring commits based on message content or submitter, remembering reference repositories, remembering timeout values, etc.

The git client plugin provides a git SCM abstraction and allows the user to select one of two implementations, either command line git, or the pure Java JGit implementation.  It is called by the git plugin (and by other plugins which need git functionality).  The git client plugin was created as a result of the refactoring which created git plugin 2.x.  The git plugin 1.x code was hard to maintain, so Kohsuke Kawaguchi, Nicolas de Loof, and others created the git plugin 2.x implementation, with the git client plugin extracted as a git SCM API.

If the command line git implementation is chosen, then the command line git installed on the slave which executes the job is used to perform the git operations.  If the JGit implementation is chosen, then git operations are performed within the Jenkins process.

The command line git implementation is the "reference implementation".  It has the most features, and seems to be the most frequently used.  There are a number of limitations in the JGit implementation which don't exist in the command line git implementation.  Those use cases which it implements are generally as capable as the command line git implementation.  There is a little more information on command line git vs. JGit at https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-WhyNotJGit .

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/D2DE416D.1595E%25ashish.yadav%40firemon.com.
For more options, visit https://groups.google.com/d/optout.

Ashish Yadav

unread,
Feb 8, 2016, 3:38:46 PM2/8/16
to jenkins...@googlegroups.com
Thanks for the clarification. How/where do I see the option for the git client plugin to see if it is using the command line git or jgit?

Mark Waite

unread,
Feb 8, 2016, 4:01:34 PM2/8/16
to jenkins...@googlegroups.com
If you enabled JGit from the Jenkins global configuration, then there will be a pick list in each project configuration page which allows you to select either the default "Git executable" or JGit as the "Git executable".

I've attached two pictures that show the difference in my project configuration page.

Here's the default:

Default-Git-executable.JPG

Here's the JGit case:

JGit-Git-executable.JPG

Mark Waite

Ashish Yadav

unread,
Feb 8, 2016, 4:15:43 PM2/8/16
to jenkins...@googlegroups.com

Jenkins configuration:


I ran ‘git - - version’ on my job and it looks like it is using the ‘default’ git installed on the slave node instead of the git plugin [v2.2.7]. 
Is that correct?

Job output
$ /bin/sh -xe /tmp/hudson1026664733309319541.sh
+ git --version
git version 1.7.1

Slave Node
Slave6$ git --version
git version 1.7.1

Default-Git-executable.JPG
JGit-Git-executable.JPG

Mark Waite

unread,
Feb 8, 2016, 4:29:58 PM2/8/16
to jenkins...@googlegroups.com
I'm not sure what you mean by "instead of the git plugin v2.2.7".  

The default is to use command line git to implement the git operations published as part of the git client plugin API.  You haven't added JGit (since your screen shot would show something under the "Add Installer" button and above the "Add Git" button).  Therefore, the git client plugin is using the command line git implementation on your slave (git version 1.7.1) to implement the git operations published as part of the git client plugin API.

If you click "Add Git", you'll see JGit as one of the choices.  That's how you enable JGit.

Screen shot with it enabled:

Git-global-config.JPG

Mark Waite


On Mon, Feb 8, 2016 at 2:15 PM Ashish Yadav <ashish...@firemon.com> wrote:

Jenkins configuration:
Screen Shot 2016-02-08 at 3.12.02 PM[1].png
Reply all
Reply to author
Forward
0 new messages