简体   繁体   中英

Jenkins pipeline script from SCM: git checkout ERROR: Unable to retrieve commit message

I created a Jenkinsfile and put it on Git repo. I have Linux VM that has this pipeline that config with a script from SCM and working find. I created a Windows VM with Jenkins also and create the same pipeline again with the same configuration (with light checkout) and got a plugin error. After unmark the light checkout the git finds the repo but on the git checkout -f part error throw.

Error: ERROR: Unable to retrieve commit message

after the error the git try to run git rev-list --no-walk on the directory path of the job (C:/..//.Jenkinsfile) and get the error not found(I checked and the file exist ).

I found I was getting this issue on Windows 10 when the job runs on the "master" node. Setting up a new Jenkins node, starting the JNLP Java app, then specifying the "agent", using a label in the pipeline was my "workaround".

(Edit: Though be great to dig deeper and understand why it's failing (assume some Windows Access permissions of git) as I'm now hitting this error when trying to use a Shared Library. The git checkout is failing to "read the commit message" however it does actually clone the branch, but fails to find the vars/src directories.)

There is an issue with the Shared Library, and it running as the Local System, despite running a manual library step on my "agent". I followed steps to setup SSH for the local system, still no luck. In the end, I setup a new Linux Mint system, to be the Jenkins Master, then use Windows agents for the clone/build and all works a treat!

TL;DR Shared Libraries on Windows is tricky, use a Linux Jenkins Master as a workaround!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM