Hello,
I have
installed Jenkins on my Windows 10 machine, created a pipeline and run it. When
it runs I get a message "ERROR: Unable to retrieve commit
message" when I try to checkout the last commit. The commit number
is correct and I can run the steps listed in the console output by hand without
the error. Does anyone know why I am getting this error?
I am using Jenkins 2.263.3 and Git plugin 4.5.2.
Note that I get the same error whether I use a pipeline or freestyle project. I am not checking out the master branch, does that matter?
The pipeline used (credentials and repo url XXXX'ed out):
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout([
$class: 'GitSCM',
branches: [[name: 'feature/test-PM']],
userRemoteConfigs: [[credentialsId: 'XXXXXX', url: 'XXXXXX']]
])
}
}
stage('Build') {
steps {
echo "Build is $BUILD_NUMBER : Node name is $NODE_NAME"
}
}
stage('Test'){
steps {
echo 'Testing...'
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
}
}
}
}
The pipeline output (credentials and repo url XXXX'ed out):
Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] nodeRunning on Jenkins in C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\TestBuild1[Pipeline] {[Pipeline] stage[Pipeline] { (Checkout)[Pipeline] checkoutThe recommended git tool is: NONEusing credential XXXXXXCloning the remote Git repositoryCloning repository XXXXXX > git.exe init C:\Windows\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\TestBuild1 # timeout=10Fetching upstream changes from XXXXXX > git.exe --version # timeout=10 > git --version # 'git version 2.30.0.windows.2'using GIT_ASKPASS to set credentials > git.exe fetch --tags --force --progress -- XXXXXX +refs/heads/*:refs/remotes/origin/* # timeout=10 > git.exe config remote.origin.url XXXXXX # timeout=10 > git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10Avoid second fetch > git.exe rev-parse "refs/remotes/origin/feature/test-PM^{commit}" # timeout=10 > git.exe rev-parse "feature/test-PM^{commit}" # timeout=10Checking out Revision aeb4a265be3a3a7b1b5fc4dd655c9f0dc6f284fa (refs/remotes/origin/feature/test-PM) > git.exe config core.sparsecheckout # timeout=10 > git.exe checkout -f aeb4a265be3a3a7b1b5fc4dd655c9f0dc6f284fa # timeout=10ERROR: Unable to retrieve commit messageorg.eclipse.jgit.errors.MissingObjectException: Missing unknown aeb4a265be3a3a7b1b5fc4dd655c9f0dc6f284fa at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135) at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:203) at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:917) at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:827) at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:25) at hudson.plugins.git.util.RevCommitRepositoryCallback.invoke(RevCommitRepositoryCallback.java:13) at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.withRepository(AbstractGitAPIImpl.java:29) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.withRepository(CliGitAPIImpl.java:84) at hudson.plugins.git.GitSCM.printCommitMessageToLog(GitSCM.java:1394) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1360) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93) at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80) at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) > git.exe rev-list --no-walk aeb4a265be3a3a7b1b5fc4dd655c9f0dc6f284fa # timeout=10[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (Build)[Pipeline] echoBuild is 37 : Node name is master[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (Test)[Pipeline] echoTesting...[Pipeline] }[Pipeline] // stage[Pipeline] stage[Pipeline] { (Deploy)[Pipeline] echoDeploying...[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineFinished: SUCCESS
--
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/CAGu5ryKes3fD-mVZBOPsDBi50LgtcO0F%3D9UsUd_tHc%3Dae%3DPatg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/fd3fa532-ecdd-4548-ad29-050d0d8b236fn%40googlegroups.com.
On Jan 29, 2021, at 7:21 PM, Mark Waite <mark.ea...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGs1AYG6JSAze0BguGdKZd8--rk3_WeXwCymo2U1MpvZw%40mail.gmail.com.
Mark,I tried to reproduce your steps as best I could.- I already have git, java and jenkins installed so I did not re-install them.- I added the git and java paths to the jenkins configuration.- I replaced my repo with a public repo on GitHub since it looks like I would need credentials to access yours.I still get the same error.I did notice the following:- If I add a bat 'dir' command to the test stage, it shows that the directory is the jenkins working directory, but there are no files in that directory.- Once the pipeline has completed, I can look at the jenkins working directory and see all the files I expect to be there.- If I try to run a batch file from the repo in the test stage (or any other stage), I get an error that the file does not exist.- If I try to run a batch file from a different directory on the machine it successfully runs that batch file.It seems like the checkout has not actually cloned the repo to my jenkins workspace while running the pipeline, but that the files are there when the pipeline has finished. Is this correct?
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/44fc64b8-c445-40e6-b54a-d2f4c67681fan%40googlegroups.com.
I am using a declarative pipeline. It's not in a Jenkinsfile, however.Thanks,PatThe last pipeline definition I used is below:pipeline {agent anystages {stage('Build') {steps {echo 'Building'checkout([$class: 'GitSCM',branches: [[name: '*/master']],userRemoteConfigs: [[url: 'https://github.com/sixeyed/jenkins-pipeline-demos.git']]])}}stage('Test') {steps {echo 'Testing'}}stage('Deploy') {steps {echo 'Deploying'bat 'dir'}}}}
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/52da7f74-56e1-495d-8a03-3a0b34d944e3n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/365d4da8-d139-4502-b4b6-a860864c2193n%40googlegroups.com.