4

We are using jgit for the git project to checkout and complete the jenkins flow. It passes the snapshot build but fails for release build with the below error :

Building on master in workspace /home/jenkins2/jenkins/jobs/Git-end_to_end_4.0/workspace
Fetching changes from the remote Git repository
Checking out Revision 302b3bc2190db18b4661407ec67918e4f8ca65fc (refs/remotes/lighthouse/master)
Property '-Dm3plugin.lib' is already part of MAVEN_OPTS. This is usually a leftover of previous build which was forcibly stopped. Replacing the value with an updated one. Please remove it from the job configuration.
[RELEASE] Release build triggered
 > jgit rev-parse --verify HEAD # timeout=10
ERROR: Failed to parse POMs
java.io.IOException: Failed retrieving current commit hash: Error performing command: jgit rev-parse --verify HEAD
    at org.jfrog.hudson.release.scm.git.GitManager$CurrentCommitCallable.invoke(GitManager.java:194)
    at org.jfrog.hudson.release.scm.git.GitManager$CurrentCommitCallable.invoke(GitManager.java:168)
    at hudson.FilePath.act(FilePath.java:914)
    at hudson.FilePath.act(FilePath.java:887)
    at org.jfrog.hudson.release.scm.git.GitManager.getCurrentCommitHash(GitManager.java:52)
    at org.jfrog.hudson.release.scm.git.GitCoordinator.prepare(GitCoordinator.java:74)
    at org.jfrog.hudson.release.maven.MavenReleaseWrapper.setUp(MavenReleaseWrapper.java:131)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:643)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:585)
    at hudson.model.Run.execute(Run.java:1676)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:231)

For reference , below are my version details :

Jenkins version : Jenkins ver. 1.554

Git client plugin : 1.17.1

Git plugin : 2.4.0

I have visited couple of pages in and out of stackoverflow , but did not get the proper response. Will appreciate any further suggestion.

Community
  • 1
  • 1
dildeepak
  • 1,080
  • 2
  • 12
  • 30
  • I think the GitManager class is not providing the actual output of the jgit command execution, without that it will be hard to tell what actually fails. Can you run the jgit command manually in the jenkins workspace? – centic Dec 07 '16 at 05:59
  • 1
    Please state your comments, if you are downgrading the question!! – dildeepak Dec 21 '16 at 07:45
  • The best option for you to make progress on this is to answer the question in my previous comment, the question obviously does not have enough information yet for anybody to suggest a solution... – centic Dec 21 '16 at 08:07
  • What is the command, you want me to run in the jenkins workspace ?? – dildeepak Dec 21 '16 at 11:17

2 Answers2

2

From your console output it is clear that your Jgit is unable to fetch the SHA of the latest commit from the cloned repository present in you workspace. The latest commit Hash is required to Parse the pom file for release build.

One reason (not likely but still if u r using pretty old Jgit) might be that the Jgit version you have configured in your Jenkins doesn't support the command to retrieve SHA of current commit ((as Jgit is still in development phase and not yet a complete replacement for git-cli and that's why jenkins git-client plugin uses git-cli by default and not Jgit even though the latter comes with it's own set of advantages... For more info pls refer Jgit official docs))

Second cause (most probable) can be that you are not using the right combination of git plugin version, git-client plugin version and Jenkins version. All major DevOps tools are equally famous for plugin related issues as they are for the purpose they serve. And trust me... at times it becomes a nightmare for a DevOps engineer to resolve plugin issue.

Anyways it would be great if you could provide the version of plugins and tools you are using (as they form to be part of critical piece of information which might come handy in resolving d issue.. Moreover your question might get downvoted by SO community members if your question lacks in availability of such important details)

For your reference:- I have been using Jgit in my Jenkins 1.596.2, with git-client plugin 1.18.0, git plugin 2.4.0. and it works as smooth as silk for both snapshot as well as release build.. Hope this helps.. :)

  • Thanks for the very long story,, although i did not find much relevant steps or commands form this :) BTW, as requested, i have edited my question with plugin information. – dildeepak Jan 09 '17 at 16:50
  • Also, the answers can also be down-voted if it fails to provide the simple, short and clear answer :) – dildeepak Jan 09 '17 at 17:02
1

After so many days of head scratch, and even after putting the bounty, i did not get the proper help for Jgit .

I changed from Jgit to GIT plugin and it resolved my problem.

dildeepak
  • 1,080
  • 2
  • 12
  • 30