Jenkins远程执行shell脚本,超时报错(ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,001 ms])
阅读原文时间:2023年08月09日阅读:1

通过Jenkins远程执行脚本时,发现Jenkins构建任务失败,但是服务器本身的脚本是生效的。

排查确认是Jenkins构建任务超时,导致Jenkins看板显示任务构建失败,但是服务器上的自动脚本执行完全正常。


1. 问题描述:

  Jenkins任务看板:

  查看该构建任务的控制台输出

  控制台输出日志:

Started by user 王志宇
Running as SYSTEM
Building in workspace /root/.jenkins/workspace/create_database_10.16.23.163(志宇)
SSH: Connecting from host [qy-ggyf-zyl-32]
SSH: Connecting with configuration [10.16.23.163] …
SSH: Disconnecting configuration [10.16.23.163] …
ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,001 ms]
Finished: UNSTABLE

2. 问题解决:

  调整超时时间为1200000ms(20分钟),默认为120000ms(2分钟)

  再次构建任务,构建成功。


重点是:远程shell脚本执行时间不能 超过Jenkins任务配置的超时时间。