我在声明性管道中从 GitHub 克隆时遇到问题。我试过这个:
git branch: 'refs/tags/5.9.0',
credentialsId: '<some credentials>',
url: "https://github.com/ARM-software"
这给出了这个错误:
The recommended git tool is: NONE
No credentials specified
> git rev-parse --resolve-git-dir /var/lib/jenkins/jobs/RoomResponseRef/workspace/CMSIS_5/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/ARM-software # timeout=10
Fetching upstream changes from https://github.com/ARM-software
> git --version # timeout=10
> git --version # 'git version 2.34.1'
Setting http proxy: git-mirror-uk.ctuk.lan:8080
> git fetch --tags --force --progress -- https://github.com/ARM-software +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/ARM-software
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force --progress -- https://github.com/ARM-software +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://github.com/ARM-software/': gnutls_handshake() failed: An unexpected TLS packet was received.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997)
... 11 more
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
和
checkout([
$class: 'GitSCM',
extensions: [[
$class: 'CloneOption',
shallow: true,
depth: 1,
timeout: 30]],
userRemoteConfigs: [[
url: 'https://github.com/ARM-software/CMSIS_5.git',
credentialsId: 'some credentials']]
导致
The recommended git tool is: NONE
using credential 4c7c891d-16c8-412e-8753-5f268ea5732f
> git rev-parse --resolve-git-dir /var/lib/jenkins/jobs/RoomResponseRef/workspace/CMSIS_5/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/ARM-software/CMSIS_5.git # timeout=10
Using shallow fetch with depth 1
Fetching upstream changes from https://github.com/ARM-software/CMSIS_5.git
> git --version # timeout=10
> git --version # 'git version 2.34.1'
using GIT_SSH to set credentials Uk Jenkins Credentials
Verifying host key using known hosts file, will automatically accept unseen keys
Setting http proxy: git-mirror-uk.ctuk.lan:8080
> git fetch --tags --force --progress --depth=1 -- https://github.com/ARM-software/CMSIS_5.git +refs/heads/*:refs/remotes/origin/* # timeout=30
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/ARM-software/CMSIS_5.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1241)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --depth=1 -- https://github.com/ARM-software/CMSIS_5.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: fatal: unable to access 'https://github.com/ARM-software/CMSIS_5.git/': gnutls_handshake() failed: An unexpected TLS packet was received.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:997)
... 11 more
ERROR: Error fetching remote repo 'origin'
ERROR: Maximum checkout retry attempts reached, aborting
我尝试过没有凭据、不同的分支机构等。
我可以在从机上进行本地 git 克隆,并且
sh 'rm -rf CMSIS_5 && git clone --depth 1 --branch 5.9.0 https://github.com/ARM-software/CMSIS_5.git'
在我的 Jenkinsfile 中运行良好。
我有什么遗漏的吗?
谢谢!
查看此日志条目:
Setting http proxy: git-mirror-uk.ctuk.lan:8080
看来您在访问 github.com 之前设置了代理。您的
sh
命令不会执行此操作并成功克隆。我会找到是什么让 Jenkins git 插件使用代理,以及该代理是否按预期工作(对于 https - 我对此表示怀疑)。