大网数据广告活动
服务器运维问答

jenkins cli build via ssh is disconecting after 10 minutes

· 52CE 我爱测

I have two jenkins instances. I want job at 1st instance to invoke job at 2nd instance, wait until it ends and perform some actions (using artifacts produced by job @ 2nd) I've come up with this solution - using Jenkins CLI comma…

问题原文

原帖链接 · tworec · CC BY-SA 3.0

I have two jenkins instances. I want job at 1st instance to invoke job at 2nd instance, wait until it ends and perform some actions (using artifacts produced by job @ 2nd)

I've come up with this solution - using Jenkins CLI commands via SSH

ssh -p 2222 second-jenkins build second-job -s -v <further options>

But this session disconnects after 10minutes with message:

Received disconnect from 192.168.147.102: 2: User idle has timed out after 600000ms.

I found ssh client option named ServerAliveInterval

ssh -o ServerAliveInterval=30 -p 2222 second-jenkins build second-job -s -v <...>

Documentation for this option says

ServerAliveInterval

Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server. This option applies to protocol version 2 only.

This works but only when server is quiet by at least 30 seconds within every 10 minutes. Of course I can use 1 second instead 30, but it wont work for jobs with continous console output (eg. maven builds).

Is there solution which keep connection alive even for hevy console output jobs?

已采纳解答

原帖链接 · Réda Housni Alaoui · CC BY-SA 4.0

Add this to Jenkins startup to disable the SSHD timeout:

-Dorg.jenkinsci.main.modules.sshd.SSHD.idle-timeout=0

See also https://blog.redaalaoui.me/blog/jenkins-cli-ssh-timeout/

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-08-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。