In a pipeline script from SCM, using a git repository with Refspec, readTrusted is not using the refsspec are fails with error "Couldn't find remote ref". Example Pipeline job wftest created and configured as Pipeline script from SCM with the following parameters:
- SCM: Git
- Repository URL: g...@git.serv.d.net:ts-source.git
- Refspec: +refs/heads/:refs/remotes/origin/ +refs/changes/:refs/remotes/origin/
- Branch Specifier: 4eedb3b
- Script Path: .jenkins/test.groovy
.jenkins/test.groovy
println readTrusted(".jenkins/test.groovy")
Build log {{}}
Checking out git g...@git.serv.d.net:ts-source.git into /var/lib/jenkins/jobs/wftest/workspace@script to read .jenkins/test.groovyNo credentials specified > git rev-parse --is-inside-work-tree # timeout=10Fetching changes from the remote Git repository > git config remote.origin.url g...@git.serv.d.net:ts-source.git # timeout=10Fetching upstream changes from g...@git.serv.d.net:ts-source.git > git --version # timeout=10 > git fetch --tags --progress g...@git.serv.d.net:ts-source.git +refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/remotes/origin/* > git rev-parse 4eedb3b^{commit} # timeout=10Checking out Revision 4eedb3baaa6d528d22180784e0001d99d618bda9 (detached) > git config core.sparsecheckout # timeout=10 > git checkout -f 4eedb3baaa6d528d22180784e0001d99d618bda9Commit message: ".jenkins: make the jobseed job running in sandbox" > git rev-list --no-walk 3c75ef69338675fe751d97af3173c206aef58d94 # timeout=10Running in Durability level: MAX_SURVIVABILITY[Pipeline] Start of Pipeline[Pipeline] readTrusted[Pipeline] End of Pipelinehudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b --prune" returned status code 128:fatal: Couldn't find remote ref refs/heads/4eedb3bfatal: The remote end hung up unexpectedly at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442) at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:351) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174) at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:101) at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Finished: FAILURE
The expected behavior is that readTrusted results in "git fetch -tags -progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b +refs/config/4eedb3b:refs/remotes/origin/4eedb3b --prune". However "git fetch -tags progress origin +refs/heads/4eedb3b:refs/remotes/origin/4eedb3b -prune" is used. |