为什么我无法重建作业?

为什么我无法重建作业?

我有一个jenkins服务器,其中jenkins从2.220版本升级到2.387.1,所有插件都已升级。

当我重建工作时,它给了我以下输出:

Started by user abc
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/DEF_GW_ENROLL_USER_PREPROD
[DEF_GW_ENROLL_USER_PREPROD] $ /bin/bash -x /tmp/jenkins81696621479514690.sh
+ export SSH_CONF=/var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1
+ SSH_CONF=/var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1
+ echo PREPROD
PREPROD
+ export targets=batch-host
+ targets=batch-host
+ for host in '$targets'
+ ssh -F /var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1 batch-host 'sudo python add_user_pastdated.py web.pre.domain.com abc1234 1 target.internal.domain.com false AUTHSERVER_V1R1 KPREHA_002 8  PST true'
ssh_exchange_identification: Connection closed by remote host
Build step 'Execute shell' marked build as failure
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] Skipped based on build state FAILURE
Finished: FAILURE

我尝试手动进行 ssh,通过将配置文件从/var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1复制到~/.ssh/,然后运行 ​​ssh 命令,连接成功建立,我就可以进入服务器了。

jenkins.log空的,并且 ssh 插件没有显示任何错误消息,所以我目前没有任何线索。

根本原因可能是什么?

答案1

您可以进行一些测试:检查文件权限/var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1和相应的私钥,然后检查所有权,它必须由 Jenkins 用户拥有,chown必要时使用

sudo chown jenkins:jenkins /var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1
sudo chown jenkins:jenkins /var/lib/jenkins/.ssh/id_rsa (or the corresponding private key file)

还要检查 ssh 配置/var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1

尝试以 Jenkins 用户身份手动建立 SSH 连接

sudo su - jenkins
ssh -F /var/lib/jenkins/.ssh/config/ssh_config_preprod-ue1 batch-host

您还可以查看远程主机日志/var/log/auth.log(或/var/log/secure

相关内容