如何调试Jenkins错误消息“找不到合适的ssh代理提供程序”?

bnlyeluc  于 2022-11-02  发布在  Jenkins
关注(0)|答案(5)|浏览(205)

我在Win7上使用Jenkins,并且我已经安装了Tomcat for ssh-agent插件。我可以通过git bash和ssh克隆我的GitLab项目。
但如果我用Jenkins来构建这个项目,它总是说:

[ssh-agent] Using credentials IliptonChen(APRTest)
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
FATAL:[ssh-agent] Unable to start agent

The full output text is here
我做错什么了吗?

hivapdat

hivapdat1#

检查ssh-agent used by Jenkins的版本。
此错误(适用于Linux,但也可能适用于Windows)报告(10天前,2014年1月)此相同的错误消息:
JENKINS-20276 : Native Library Error after upgrading ssh-agent from 1.3 to 1.4”的名称。
降级到1.3版可解决此问题。
2019年更新,五年后:如所评论的,现在应该解决这个问题。
ssh-agent.exeGit for Windows distribution的一部分

D:\git\git>where ssh-agent.exe
D:\prgs\gits\current\usr\bin\ssh-agent.exe

(假设path/to/git/usr/bin是Jenkins使用的%PATH%中的第一个)

lb3vh1jj

lb3vh1jj2#

假设你已经在Windows slave上安装了Windows Git,它附带了ssh-agent二进制文件(例如C:\Program Files\Git\usr\bin)。尝试将其路径添加到系统变量PATH中。
否则,取消勾选 SSH Agent,并通过从 Source Code Management 部分的下拉列表中选择 Credentials 来选择凭据。
另一种方法是为该GitHub用户生成personal API tokenOAuth),并将其与您的仓库地址沿着包含在内,例如:

git clone https://4UTHT0KEN@github.com/foo/bar
nxagd54h

nxagd54h3#

对于Windows,该插件仍然要求Tomcat安装在两个master and slave中。

nvbavucw

nvbavucw4#

我收到这个错误是因为我使用的是Ubuntu镜像的代理,它没有安装SSH。

agent {
    docker { image 'ubuntu:focal' }
}

...因此,解决方案非常简单,只需在管道中安装SSH即可:

steps {
    sh "apt-get update && apt-get install ssh -y"
    // rest of your steps here...
}
piah890a

piah890a5#

在我的例子中,该错误伴随着一个关于磁盘空间耗尽的错误:

[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
[ssh-agent] Diagnostic report
[ssh-agent] * Exec ssh-agent (binary ssh-agent on a remote machine)
[ssh-agent]     hudson.AbortException: Failed to run ssh-agent: mkdtemp: private socket dir: No space left on device

所以我运行了docker system prune -a,它修复了这个问题。

相关问题