问题
I have a iOS archive job on a mac slave which will take a long time sometimes 30min The question is the ssh long connection often disconnect and caused the task fail.
Now I want to ask how can I do to avoid this question? What I'm looking for is when the long connection disconnect but the task continue to perform. How can I do?
回答1:
Adding a keepAlive option is a feature request since 2014
As proposed workarounds, this ticket includes:
- Change the
/etc/ssh/ssh_config
by appending the following line to the end of this file. This tells the ssh client to sendnop
command periodically to avoid the ssh connection being disconnected.
The unit of 80 is seconds. You may tune this parameter based on your network condition.
ServerAliveInterval 80
- In the Jenkins slave configuration page, change the Launch method to "
Launch slave via execution of command on the Master
". See the Jenkins built-in help for more details.So far, I haven't see any issues in this configuration. Hope this helps.
See also "Remoting issues / SSH slaves".
来源:https://stackoverflow.com/questions/49441671/jenkins-ssh-slave-disconnect-to-make-the-task-continue-perform