I'm trying to set up Jenkins to pull and build a project from bitbucket.
I'm using this on IIS 8.5 Server 2012 r2. I've set up the Git and Bitbucket plugins.
I've set up a project with the following:
Branch Specifier (blank for 'any'): "origin/master"
I'm not sure if this is part of the issue, but I only have that one branch in my repo.
When running the build I'm getting the following error, I can't find any information as to what the ID is that's invalid, can anyone point me in the right direction?
It looks like it's fetching the hash from the last commit, and then saying invalid ID, I'm not sure if that's the hash ID or if it's some kind of environmental ID as it's referencing the build directory (which does exist and has the correct permissions) when it fails
Error log:
Started by user Stu
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Fenix
> C:\Program Files\Git\git-cmd.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files\Git\git-cmd.exe config remote.origin.url https://user@bitbucket.org/project/project-fenix.git # timeout=10
Fetching upstream changes from https://user@bitbucket.org/project/project-fenix.git
> C:\Program Files\Git\git-cmd.exe --version # timeout=10
using GIT_ASKPASS to set credentials
> C:\Program Files\Git\git-cmd.exe fetch --tags https://user@bitbucket.org/project/project-fenix.git +refs/heads/*:refs/remotes/origin/*
> C:\Program Files\Git\git-cmd.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
FATAL: Invalid id: C:\Program Files (x86)\Jenkins\workspace\Fenix>
org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: C:\Program Files (x86)\Jenkins\workspace\Fenix>
at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:232)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.revParse(CliGitAPIImpl.java:689)
at hudson.plugins.git.GitAPI.revParse(GitAPI.java:316)
at hudson.plugins.git.util.DefaultBuildChooser.getHeadRevision(DefaultBuildChooser.java:130)
at hudson.plugins.git.util.DefaultBuildChooser.getCandidateRevisions(DefaultBuildChooser.java:112)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:992)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1095)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Finished: FAILURE
I've seen a lot of places reference using git.cmd
instead of the .exe
, but no cmd file exists in my Git directory. If I use any of the .exe
files it times out and cannot make a connection, so I'm using C:\Program Files\Git\git-cmd.exe
and it is at least connecting.
The Git verion is Git for Windows v2.10.2
If anyone could point me in the right direction that would be greatly appreciated as I can't find anything online about this specific error.
Please don't use git-cmd.exe as the git implementation for Jenkins. Use git.exe from the bin directory of the git installation, or from the cmd directory of the git instalaltion. It works better, is tested, and is the supported way.
As far as I can tell, git-cmd.exe is the program bundled with git which is used to start a Windows command processor that includes git in the path. I'm impressed that it runs any git commands, but it seems to do so. It doesn't run all the git commands, and provides novel and interesting error messages instead.
Refer to JENKINS-45212 for an example of a use case where that form of the git program behaves incorrectly, while
git.exe
behaves as expected.The first test to try is to get rid of:
(x86)
)Since you have downloaded a portable version of Git, you can uncompress that archive in
C:\prgs\gits\git2.10.2
for instance.And you can setup your Jenkins workspace to a simpler PATH.
Then check if the issue persists.
From your Jenkins job logs:
It looks like issue 34886. In your case, maybe the remote BitBucket repo does not have a branch named "master", making the dereferencing of "
refs/remotes/origin/master^{commit}
" impossible.