Jenkins Windows Master 连接到 Slave Mac OSX

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12737021/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 15:54:13  来源:igfitidea点击:

Jenkins Windows Master to connect to Slave Mac OSX

windowsmacossshjenkinshudson

提问by sradforth

I have Jenkins set up on both my Windows7 PC and a Mac mini in order to build the various platforms (Blackberry, Android and iOS projects)

我在我的 Windows7 PC 和 Mac mini 上都设置了 Jenkins 以构建各种平台(Blackberry、Android 和 iOS 项目)

Problem I've encounered is the Win7 Master jenkins can't seem to connect to the mac slaves. I've tried opening up port 22 on the firewall so don't think it's this (although not 100% certain) and doing some reading on it all the tutorials mention about setting up SSH public keys but they all refer to mac and linux rather than Win7 as this doesn't appear to be a valid approach from what I understand.

我遇到的问题是 Win7 Master jenkins 似乎无法连接到 mac slaves。我试过在防火墙上打开端口 22,所以不要认为是这个(虽然不是 100% 确定)并阅读它所有的教程都提到了设置 SSH 公钥,但它们都指的是 mac 和 linux比 Win7,因为根据我的理解,这似乎不是一种有效的方法。

Has anyone done this and/or got any pointers as to why Win7 can't seem to see the mac? (I can ping it if that helps reassure they're on the same network)

有没有人做过这个和/或有任何关于为什么 Win7 似乎看不到 mac 的指示?(如果这有助于确保他们在同一个网络上,我可以 ping 它)

Here's the console output should it be of any use.

如果它有任何用处,这是控制台输出。

    [10/04/12 23:10:35] [SSH] Opening SSH connection to 192.168.0.102:22.
java.io.IOException: There was a problem while connecting to 192.168.0.102:22
    at com.trilead.ssh2.Connection.connect(Connection.java:793)
    at com.trilead.ssh2.Connection.connect(Connection.java:565)
    at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:650)
    at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:283)
    at hudson.slaves.SlaveComputer.call(SlaveComputer.java:200)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:346)
    at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:454)
    at com.trilead.ssh2.Connection.connect(Connection.java:733)
    ... 9 more
[10/04/12 23:10:56] [SSH] Connection closed.

采纳答案by Slav

SSH method requires that an SSH server is running on the target that you try to connect to.

SSH 方法要求 SSH 服务器在您尝试连接的目标上运行。

Maybe your Mac does not have SSH server running and/or configured.

也许您的 Mac 没有运行和/或配置 SSH 服务器。

回答by Meir Gerenstadt

Configure SSH in your MAC:

在您的 MAC 中配置 SSH:

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/<user>/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/<user>/.ssh/id_rsa.
Your public key has been saved in /home/<user>/.ssh/id_rsa.pub.

Configure SSH in your Jenkins slave configuration given the location for the ssh private key (slave path).

给定 ssh 私钥的位置(从属路径),在您的 Jenkins 从属配置中配置 SSH。

More details in my Blog

更多细节在我的博客