Jenkins Windows Slave通过OpenSSH无法启动

时间:2019-06-20 11:52:00

标签: jenkins continuous-integration

我正在尝试将Windows代理连接到jenkins,但是没有运气。我正在使用开放式SSH,目前在安装过程中未进行任何验证。启动代理时,Jenkins可以访问它,并将remote.jar放入请求的文件夹中,但是启动代理仍然存在问题。我没有任何错误描述

SSHLauncher{host='NLQA1', port=22, credentialsId='10314a78-c648-4891-aa78-c5510875e8e7', jvmOptions='', javaPath='c:/jenkins2/jdk/bin/java.exe', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.NonVerifyingKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[06/20/19 13:36:26] [SSH] Opening SSH connection to NLQA1:22.
[06/20/19 13:36:27] [SSH] WARNING: SSH Host Keys are not being verified. Man-in-the-middle attacks may be possible against this connection.
[06/20/19 13:36:28] [SSH] Authentication successful.
[06/20/19 13:36:28] [SSH] The remote user's environment is:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Admin\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=NLQA1
ComSpec=C:\WINDOWS\system32\cmd.exe
DriverData=C:\Windows\System32\Drivers\DriverData
GIT_SSH=C:\Program Files\TortoiseGit\bin\TortoisePLink.exe
HOMEDRIVE=C:
HOMEPATH=\Users\Admin
ICU_DATA=c:\Usd91\BIN
LOCALAPPDATA=C:\Users\Admin\AppData\Local
NUMBER_OF_PROCESSORS=2
OneDrive=C:\Users\Admin\OneDrive
OS=Windows_NT
Path=C:\app\client\Admin\product\12.1.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;c:\Gnuwin32;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\App;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 63 Stepping 2, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3f02
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=Admin@Domain@NLQA1 $P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
SSH_CLIENT=172.x.x.x 63458 22
SSH_CONNECTION=172.x.x.x 63458 172.x.x.x 22
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\TEMP
TMP=C:\TEMP
USERDOMAIN=Domain
USERNAME=Admin@Domain
USERPROFILE=C:\Users\Admin
windir=C:\WINDOWS
[06/20/19 13:36:28] [SSH] Starting sftp client.
[06/20/19 13:36:28] [SSH] Copying latest remoting.jar...
Source agent hash is D2D1A740134BD20D6F0855B356344342. Installed agent hash is D2D1A740134BD20D6F0855B356344342
Verified agent jar. No update is necessary.
Expanded the channel window size to 4MB
[06/20/19 13:36:29] [SSH] Starting agent process: cd "c:/jenkins2" && c:/jenkins2/jdk/bin/java.exe  -jar remoting.jar -workDir c:/jenkins2
Slave JVM has terminated. Exit code=0
[06/20/19 13:36:29] Launch failed - cleaning up connection
[06/20/19 13:36:29] [SSH] Connection closed.

Agent正在运行带有eclipsej9的takenopenjdk 11,Slave JVM has terminated. Exit code=0是我从詹金斯那里得到的所有信息。如果我rdp到计算机并手动执行c:/jenkins2/jdk/bin/java.exe -jar remoting.jar -workDir c:/jenkins2,则可以运行该代理,因此并不是完全无法启动jar。 jnlp也可以正常工作,但是我想使用ssh路由。您有什么线索是错误的,或者我该怎么做才能获得有关发射失败的更多信息?

1 个答案:

答案 0 :(得分:0)

我在ssh-slaves-plugin git repository找到了答案。我会在这里引用它,以便将来在这里使用。


使用Microsoft OpenSSH启动Windows从站

当前版本的插件不能直接在PowerShell上运行,您必须使用前缀和后缀设置来欺骗该命令并使其起作用,Windows 10计算机可以通过以下方式与Microsoft OpenSSH服务器一起作为SSH代理运行:< / p>

前缀启动代理命令

powershell -Command "cd C:\J\S ; C:\J\S\jdk\bin\java.exe -jar remoting.jar" ; exit 0 ; rem '

后缀启动代理命令

'


添加前缀和后缀为我修复了该问题。如果有人知道为什么将其包装在另一个powershell命令中,则可以随时对其进行详细说明。