Reputation: 1412
I've got Jenkins set up and building, getting triggered by git commits and all that. An example log looks like this:
00:00:00.016 Building in workspace D:\SomeWorkspace
00:00:00.016 > C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
00:00:00.047 Fetching changes from the remote Git repository
00:00:00.047 > C:\Program Files (x86)\Git\bin\git.exe config remote.origin.url http://usr:[email protected]/git/Repo.git # timeout=10
00:00:00.063 Fetching upstream changes from http://[email protected]/git/Repo.git
00:00:00.063 > C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
00:00:00.234 using .gitcredentials to set credentials
00:00:00.234 > C:\Program Files (x86)\Git\bin\git.exe config --local credential.helper store --file=\"C:\Path\To\Temp\git2724877017172338447.credentials\" # timeout=10
00:00:00.250 > C:\Program Files (x86)\Git\bin\git.exe fetch --tags --progress http://[email protected]/git/Repo.git +refs/heads/*:refs/remotes/origin/*
What I would like to do is see the output from those git commands so I can do things like double check what version of git its using, see why the git fetch
is slow, etc. but I can't figure out how to display that extra output. Any ideas? When I run those commands from the git-bash I have installed on this windows box, the git fetch
runs faster, and I'm not sure how to debug whats happening in Jenkins.
Upvotes: 4
Views: 2342
Reputation: 3482
There are two git implementations available in Jenkins, one using the commandline "git.exe" tool and one implemented in Java called JGit. Based on your example output it uses the former one.
If we look into that implementation, for example the "fetch" command, it seems it just discards the output on success.
The implementation of the fetch command starts here (link to a snapshot of "master" at the time of answering):
A bit down in execute(), on line 313 it calls launchCommandWithCredentials(...);
which returns the output of the command. It is however not stored anywhere, thus discarded.
Tracking how the output is returned: The launchCommandWithCredentials method is implemented starting on line 1337. On line 1441 it calls
launchCommandIn(...);
which in turn is implemented starting on line 1672. On line 1689 it finally runs the actual command and on 1691 it collects the command output. If there return code is not 0, i.e. if there is some error, it throws an exception (also containing the command output) on line 1693, otherwise returns the command output. This is in turn returned by launchCommandWithCredentials 1441. Now we get back to line 313 where the return value is discarded.
Looking at the checkout command it seems the output is discarded on success as well.
So as it seems if you really need the output you would either have to
Upvotes: 2