Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
277 views
in Technique[技术] by (71.8m points)

git - Jenkins checkout failure on Windows

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. Why am I 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] node
Running on Jenkins in C:Windowssystem32configsystemprofileAppDataLocalJenkins.jenkinsworkspaceTestBuild1
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout)
[Pipeline] checkout
The recommended git tool is: NONE
using credential XXXXXX
Cloning the remote Git repository
Cloning repository XXXXXX
 > git.exe init C:Windowssystem32configsystemprofileAppDataLocalJenkins.jenkinsworkspaceTestBuild1 # timeout=10
Fetching 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=10
Avoid second fetch
 > git.exe rev-parse "refs/remotes/origin/feature/test-PM^{commit}" # timeout=10
 > git.exe rev-parse "feature/test-PM^{commit}" # timeout=10
Checking out Revision aeb4a265be3a3a7b1b5fc4dd655c9f0dc6f284fa (refs/remotes/origin/feature/test-PM)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f aeb4a265be3a3a7b1b5fc4dd655c9f0dc6f284fa # timeout=10
ERROR: Unable to retrieve commit message
org.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] echo
Build is 37 : Node name is master
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test)
[Pipeline] echo
Testing...
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Deploy)
[Pipeline] echo
Deploying...
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
question from:https://stackoverflow.com/questions/65939258/jenkins-checkout-failure-on-windows

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...