jenkins - Jenkis CLI 不起作用:警告:Jenkins 没有返回标头“X-SSH-Endpoint”
问题描述
我有Jenkins ver. 2.205
,Windows 10
我有以下情况
Configure Global Security
已Enable security
检查。- 我创建了
id_rsa_jenkins
和id_rsa_jenkins.pub
键。公钥的值已添加到 Jenkins 中用于我的帐户SSH Public Keys
。 - 我有
jenkins-cli.jar
文件,下载自http://localhost:9090/cli/
命令行界面
当我执行以下操作时(为了演示目的,分成多行):
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
命令上,例如:
- 帮助
- 我是谁
- 列表作业
等等
有什么遗漏或错误?
解决方案
对于观众:
原始帖子中提供的说明是强制性的。但以下说明也是强制性的:
- 已安装
SSH
插件 - 在
Configure Global Security
,在SSH Server
部分(在底部)中,继续启用它,在这种情况下,我使用Fixed
value 选项。
注意似乎该random
选项仅对这种jenkins-cli.jar
情况有用。这是因为通过SSH
连接(即ssh -l jenkinsusername -p 2020 localhost list-jobs
:)必须知道端口,在这种情况下2020
。
因此Fixed
orRandom
是可行的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.
这个视频很有价值:
推荐阅读
- django - Django注释字段未传递给序列化程序
- sql - 有没有办法检查两个数据集是否相同(Pentaho 和 OracleDB)
- java - HtmlUnit - 按值获取电台
- tensorflow - 为什么我的深度学习模型不使用 GPU 而是在 CPU 中工作?
- excel - excel 2003 数据库字段 - 是否可以更改名称
- php - 如何在 laravel 的 darryldecode 购物车中设置最大数量?
- ruby-on-rails - Angular 网站无法在 Frefox 和 Safari 等不同浏览器上运行
- javascript - 如何在 react-native 中调用另一个纯类中的方法?
- javascript - 获取在对象字面量内定义的符号的值并迭代其值
- java - 如何使用 Apache POI 读取 Excel 文件中特定行的数据?