首页 > 解决方案 > Jenkis CLI 不起作用:警告:Jenkins 没有返回标头“X-SSH-Endpoint”

问题描述

我有Jenkins ver. 2.205Windows 10我有以下情况

命令行界面

当我执行以下操作时(为了演示目的,分成多行):

java -jar jenkins-cli.jar 
          -s http://localhost:9090/ 
          -i C:\Users\windowsusername/.ssh/id_rsa_jenkins 
          -ssh 
          -user jenkinsusername 
          help

出现:

Enter passphrase for C:\Users\windowsusername\.ssh\id_rsa_jenkins:

问题

我写了有效的密码,然后出现以下内容:

Nov 23, 2019 11:28:22 AM org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar getOrCreateProvider
INFO: getOrCreateProvider(EdDSA) created instance of net.i2p.crypto.eddsa.EdDSASecurityProvider
Nov 23, 2019 11:28:22 AM hudson.cli.SSHCLI sshConnection
WARNING: No header 'X-SSH-Endpoint' returned by Jenkins

如上图,没有出现预期的数据

它发生在任何Jenkins CLI命令上,例如:

等等

有什么遗漏或错误?

标签: jenkinsjenkins-cli

解决方案


对于观众:

原始帖子中提供的说明是强制性的。但以下说明也是强制性的:

  • 已安装SSH插件
  • Configure Global Security,在SSH Server部分(在底部)中,继续启用它,在这种情况下,我使用Fixedvalue 选项。

注意似乎该random选项仅对这种jenkins-cli.jar情况有用。这是因为通过SSH连接(即ssh -l jenkinsusername -p 2020 localhost list-jobs:)必须知道端口,在这种情况下2020

因此FixedorRandom是可行的jenkins-cli.jar(它不要求使用端口号)但是对于SSH连接是强制性的,知道端口号(这里Fixed需要它)

此外,在Jenkins SSH中表明:

Configuration

By default, Jenkins will listen on a random available port, so as not to break 
existing deployments. But this is most likely not very useful, so the administrator 
is encouraged to change this from the global security configuration page by assigning 
a fixed port. This configuration UI will also allow you to disable this feature. 

这个视频很有价值:


推荐阅读