Windows slave by ssh

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows slave by ssh

Jérôme Godbout

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

slide
It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?



On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Windows slave by ssh

Jérôme Godbout

Well, that doesn’t really help to put quote into the JAVA_HOME variable either:

[08/26/20 16:48:23] [SSH] Checking java version of "C:\Program Files\Java\jdk1.8.0_161"/bin/java

Couldn't figure out the Java version of "C:\Program Files\Java\jdk1.8.0_161"/bin/java

'"C:\Program Files\Java\jdk1.8.0_161"' is not recognized as an internal or external command,

operable program or batch file.

 

I guess I will just install Java into a non space path, feel like the 90’ avoid all space in path for bad path handling… I hardly believe I’m the first one to install Java into default Program Files folder for this?! Anyway copy time to c:\Java

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB23151EA416B834D7111121DDCD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

Mark Waite-2
In reply to this post by slide
I've preferred to install AdoptOpenJDK in a location that does not include spaces.  Oracle JDK licensing is more restrictive than I'm willing to accept and I want the latest Java 8 fixes.

On Wed, Aug 26, 2020 at 2:23 PM Slide <[hidden email]> wrote:
It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?



On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGh_FntpKrRaEDCCtD-Xx59g8gKGvhQdmGV0tH4_MmvYw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Windows slave by ssh

Jérôme Godbout

WARNING, the following message contain strong opinion, if that do not suit you, stop reading now.

 

Don’t worry, I hate all Java equally... they fail the only promise they ever had, run everywhere… I hope this language rot in hell.

 

From: [hidden email] <[hidden email]> On Behalf Of Mark Waite
Sent: August 26, 2020 4:52 PM
To: Jenkins Users <[hidden email]>
Subject: Re: Windows slave by ssh

 

I've preferred to install AdoptOpenJDK in a location that does not include spaces.  Oracle JDK licensing is more restrictive than I'm willing to accept and I want the latest Java 8 fixes.

 

On Wed, Aug 26, 2020 at 2:23 PM Slide <[hidden email]> wrote:

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGh_FntpKrRaEDCCtD-Xx59g8gKGvhQdmGV0tH4_MmvYw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315064C40D28859D8BFB0DECD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

RE: Windows slave by ssh

Jérôme Godbout
In reply to this post by slide

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

slide
Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

slide
Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Windows slave by ssh

Jérôme Godbout

This is exactly what I’m using now, not more need for Cygwin for ssh (about time Microsoft 😉). Remove any space from the JAVA_HOME path solve the issue, but the default install path for Java is inside the Program Files folders, so by default it has a space. Not supporting spaces (and probably other character) is a bug. It’s not a big issue, but this should be fix. As for the \ or /, this should be handle by the  source code and perform the right conversion to node native format. In my script I always use *nix / path and convert them to native before running the actual command in a shell. I even made some Groovy pipeline functions to be platform agnostic as much as possible, the default implementation force us to put if(isUnix()) everywhere and it’s annoying. Having a function to manipulate the files and folders (create, remove, touch, move, rename) should be there by default for CI pipelines and be platform agnostic. This is pretty basic stuff.

 

This is where you realize Qt, C# and Python are way ahead into path manipulation.  Do a little as possible into Groovy-ish language and use Ansible or Python scripts to do the actual work lifting, made my life so much less painful.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 6:03 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB231531FEA65DBE1914E14D9FCD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

slide
I opened this PR against the ssh-agents-plugin  https://github.com/jenkinsci/ssh-slaves-plugin/pull/183

On Thu, Aug 27, 2020 at 6:22 AM Jérôme Godbout <[hidden email]> wrote:

This is exactly what I’m using now, not more need for Cygwin for ssh (about time Microsoft 😉). Remove any space from the JAVA_HOME path solve the issue, but the default install path for Java is inside the Program Files folders, so by default it has a space. Not supporting spaces (and probably other character) is a bug. It’s not a big issue, but this should be fix. As for the \ or /, this should be handle by the  source code and perform the right conversion to node native format. In my script I always use *nix / path and convert them to native before running the actual command in a shell. I even made some Groovy pipeline functions to be platform agnostic as much as possible, the default implementation force us to put if(isUnix()) everywhere and it’s annoying. Having a function to manipulate the files and folders (create, remove, touch, move, rename) should be there by default for CI pipelines and be platform agnostic. This is pretty basic stuff.

 

This is where you realize Qt, C# and Python are way ahead into path manipulation.  Do a little as possible into Groovy-ish language and use Ansible or Python scripts to do the actual work lifting, made my life so much less painful.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 6:03 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB231531FEA65DBE1914E14D9FCD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVevYf_T0dCfYF6uMBgK0C4vJNV-jHa2DFqsV9wGtuRPmg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

RE: Windows slave by ssh

Jérôme Godbout

Why only escape the command when it contains space, you could always do it, so other characters would also be properly escaped, the if is useless.

if(javaCommand.contains(" ")) {

 

            javaCommand = "\"" + javaCommand + "\"";

        }

 

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 27, 2020 10:11 AM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

I opened this PR against the ssh-agents-plugin  https://github.com/jenkinsci/ssh-slaves-plugin/pull/183

 

On Thu, Aug 27, 2020 at 6:22 AM Jérôme Godbout <[hidden email]> wrote:

This is exactly what I’m using now, not more need for Cygwin for ssh (about time Microsoft 😉). Remove any space from the JAVA_HOME path solve the issue, but the default install path for Java is inside the Program Files folders, so by default it has a space. Not supporting spaces (and probably other character) is a bug. It’s not a big issue, but this should be fix. As for the \ or /, this should be handle by the  source code and perform the right conversion to node native format. In my script I always use *nix / path and convert them to native before running the actual command in a shell. I even made some Groovy pipeline functions to be platform agnostic as much as possible, the default implementation force us to put if(isUnix()) everywhere and it’s annoying. Having a function to manipulate the files and folders (create, remove, touch, move, rename) should be there by default for CI pipelines and be platform agnostic. This is pretty basic stuff.

 

This is where you realize Qt, C# and Python are way ahead into path manipulation.  Do a little as possible into Groovy-ish language and use Ansible or Python scripts to do the actual work lifting, made my life so much less painful.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 6:03 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB231531FEA65DBE1914E14D9FCD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVevYf_T0dCfYF6uMBgK0C4vJNV-jHa2DFqsV9wGtuRPmg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315B53FCE5AAAC3B3C93D1ACD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

slide
Feel free to open your own PR then. I took the time to try and fix an immediate issue in the short amount of time I had to look at it. This should fix for the majority of people I believe, there will definitely be corner cases that can be addressed in the future.

On Thu, Aug 27, 2020 at 7:20 AM Jérôme Godbout <[hidden email]> wrote:

Why only escape the command when it contains space, you could always do it, so other characters would also be properly escaped, the if is useless.

if(javaCommand.contains(" ")) {

 

            javaCommand = "\"" + javaCommand + "\"";

        }

 

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 27, 2020 10:11 AM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

I opened this PR against the ssh-agents-plugin  https://github.com/jenkinsci/ssh-slaves-plugin/pull/183

 

On Thu, Aug 27, 2020 at 6:22 AM Jérôme Godbout <[hidden email]> wrote:

This is exactly what I’m using now, not more need for Cygwin for ssh (about time Microsoft 😉). Remove any space from the JAVA_HOME path solve the issue, but the default install path for Java is inside the Program Files folders, so by default it has a space. Not supporting spaces (and probably other character) is a bug. It’s not a big issue, but this should be fix. As for the \ or /, this should be handle by the  source code and perform the right conversion to node native format. In my script I always use *nix / path and convert them to native before running the actual command in a shell. I even made some Groovy pipeline functions to be platform agnostic as much as possible, the default implementation force us to put if(isUnix()) everywhere and it’s annoying. Having a function to manipulate the files and folders (create, remove, touch, move, rename) should be there by default for CI pipelines and be platform agnostic. This is pretty basic stuff.

 

This is where you realize Qt, C# and Python are way ahead into path manipulation.  Do a little as possible into Groovy-ish language and use Ansible or Python scripts to do the actual work lifting, made my life so much less painful.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 6:03 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB231531FEA65DBE1914E14D9FCD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVevYf_T0dCfYF6uMBgK0C4vJNV-jHa2DFqsV9wGtuRPmg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315B53FCE5AAAC3B3C93D1ACD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVdy8Pk83Z_tEcH3tbqtf0ns0_iyeivZe70c6bHWft7FRA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

jn...@cloudbees.com
could this be https://issues.jenkins-ci.org/browse/JENKINS-47510 ?

On Thursday, August 27, 2020 at 3:55:08 PM UTC+1 slide wrote:
Feel free to open your own PR then. I took the time to try and fix an immediate issue in the short amount of time I had to look at it. This should fix for the majority of people I believe, there will definitely be corner cases that can be addressed in the future.

On Thu, Aug 27, 2020 at 7:20 AM Jérôme Godbout <[hidden email]> wrote:

Why only escape the command when it contains space, you could always do it, so other characters would also be properly escaped, the if is useless.

if(javaCommand.contains(" ")) {

 

            javaCommand = "\"" + javaCommand + "\"";

        }

 

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 27, 2020 10:11 AM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

I opened this PR against the ssh-agents-plugin  https://github.com/jenkinsci/ssh-slaves-plugin/pull/183

 

On Thu, Aug 27, 2020 at 6:22 AM Jérôme Godbout <[hidden email]> wrote:

This is exactly what I’m using now, not more need for Cygwin for ssh (about time Microsoft 😉). Remove any space from the JAVA_HOME path solve the issue, but the default install path for Java is inside the Program Files folders, so by default it has a space. Not supporting spaces (and probably other character) is a bug. It’s not a big issue, but this should be fix. As for the \ or /, this should be handle by the  source code and perform the right conversion to node native format. In my script I always use *nix / path and convert them to native before running the actual command in a shell. I even made some Groovy pipeline functions to be platform agnostic as much as possible, the default implementation force us to put if(isUnix()) everywhere and it’s annoying. Having a function to manipulate the files and folders (create, remove, touch, move, rename) should be there by default for CI pipelines and be platform agnostic. This is pretty basic stuff.

 

This is where you realize Qt, C# and Python are way ahead into path manipulation.  Do a little as possible into Groovy-ish language and use Ansible or Python scripts to do the actual work lifting, made my life so much less painful.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 6:03 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB231531FEA65DBE1914E14D9FCD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVevYf_T0dCfYF6uMBgK0C4vJNV-jHa2DFqsV9wGtuRPmg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/24f4c3db-4f5e-461a-be37-8ba1cdef6d83n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Windows slave by ssh

Ivan Fernandez Calvo
I hate this class src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java I though to remove it and force configuring the Java path in the plugin or have Java in the PATH, it is a requirement to run the remoting process. The PR from Alex is a valid workaround meanwhile I think how to remove that class.

El jueves, 27 de agosto de 2020 a las 18:10:35 UTC+2, [hidden email] escribió:
could this be https://issues.jenkins-ci.org/browse/JENKINS-47510 ?

On Thursday, August 27, 2020 at 3:55:08 PM UTC+1 slide wrote:
Feel free to open your own PR then. I took the time to try and fix an immediate issue in the short amount of time I had to look at it. This should fix for the majority of people I believe, there will definitely be corner cases that can be addressed in the future.

On Thu, Aug 27, 2020 at 7:20 AM Jérôme Godbout <[hidden email]> wrote:

Why only escape the command when it contains space, you could always do it, so other characters would also be properly escaped, the if is useless.

if(javaCommand.contains(" ")) {

 

            javaCommand = "\"" + javaCommand + "\"";

        }

 

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 27, 2020 10:11 AM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

I opened this PR against the ssh-agents-plugin  https://github.com/jenkinsci/ssh-slaves-plugin/pull/183

 

On Thu, Aug 27, 2020 at 6:22 AM Jérôme Godbout <[hidden email]> wrote:

This is exactly what I’m using now, not more need for Cygwin for ssh (about time Microsoft 😉). Remove any space from the JAVA_HOME path solve the issue, but the default install path for Java is inside the Program Files folders, so by default it has a space. Not supporting spaces (and probably other character) is a bug. It’s not a big issue, but this should be fix. As for the \ or /, this should be handle by the  source code and perform the right conversion to node native format. In my script I always use *nix / path and convert them to native before running the actual command in a shell. I even made some Groovy pipeline functions to be platform agnostic as much as possible, the default implementation force us to put if(isUnix()) everywhere and it’s annoying. Having a function to manipulate the files and folders (create, remove, touch, move, rename) should be there by default for CI pipelines and be platform agnostic. This is pretty basic stuff.

 

This is where you realize Qt, C# and Python are way ahead into path manipulation.  Do a little as possible into Groovy-ish language and use Ansible or Python scripts to do the actual work lifting, made my life so much less painful.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 6:03 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Well, running on Cygwin is almost like running on a *NIX platform. Not exactly, but almost. I am referring to the OpenSSH-Win64 port that is now supported by MS. 

 

On Wed, Aug 26, 2020 at 2:50 PM Jason Pyeron <[hidden email]> wrote:

Sorry to be a Johnny come lately – but we have only used SSH launch of windows for quite a long time now.

 

We use Cygwin to do so. You can use any SSH server though.

 

The most important thing is to ensure Java’s home has no spaces in the path.

 

The second most important thing is to use mixed pathing constructs. E.g. javaPath='C:/programs.x64/Java/jdk-14/bin/java note the forward slashes. It is a happy middle ground for bash and java.

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: Wednesday, August 26, 2020 5:18 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

Historically, Windows agents couldn't really be run using this plugin, it is only somewhat recently that Windows had good SSH support. So, there are probably some leftovers from the plugin only being used on *NIX systems. 

 

On Wed, Aug 26, 2020 at 2:07 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

Reinstalling Java into a path like c:\Java work just fine now. Wonder why the Linux and the Windows master doesn’t show the same behavior on this? Is this code part only for *nix platform?

 

Anyway, thanks for the pointer,

Jerome

 

From: [hidden email] <[hidden email]> On Behalf Of Slide
Sent: August 26, 2020 4:23 PM
To: Jenkins User Mailing List <[hidden email]>
Subject: Re: Windows slave by ssh

 

It looks like this code would need to be updated to handle when there are spaces:  https://github.com/jenkinsci/ssh-slaves-plugin/blob/master/src/main/java/hudson/plugins/sshslaves/JavaVersionChecker.java#L91. I have the reverse, a Windows controller and Linux agents. I specify the JAVA_HOME environment variable in my agent configuration and that works. Can you try that?

 

 

 

On Wed, Aug 26, 2020 at 12:38 PM Jérôme Godbout <[hidden email]> wrote:

Hi,

I’m trying to access a Windows slave with SSH using Linux master Jenkins 2.235.5.

[08/26/20 15:24:48] [SSH] Checking java version of c:\JenkinsSlave/jdk/bin/java
Couldn't figure out the Java version of c:\JenkinsSlave/jdk/bin/java
The system cannot find the path specified.
 
[08/26/20 15:24:49] [SSH] Checking java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
Couldn't figure out the Java version of C:\Program Files\Java\jdk1.8.0_161/bin/java
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

 

But when I try it from my other Windows Jenkins master 2.251 (my development server for testing purpose) it does connect without issue and find the proper java into the same path.

 

[08/21/20 13:48:50] [SSH] Starting agent process: cd "c:\JenkinsSlave" && "C:\Program Files\Java\jdk1.8.0_161\bin\java.exe"  -jar remoting.jar -workDir c:\JenkinsSlave -jar-cache c:\JenkinsSlave/remoting/jarCache

Aug 21, 2020 1:48:50 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir

 

Seem like the c:\Program Files\Java… is not escaped properly under Linux master. How to fix that? How can I fix this?

Should I escape the env var JAVA_HOME and add quote into it? will it break something else?

 

I’m trying to move the slave execution from my development Windows laptop to our official Linux master.

 

Thanks,

Jerome

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315834EB1C8497CD210EEA4CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfLE6ybdjjMgzrpVt9UNCB0MF6CBTndkZWgXApOMnv5xQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB2315DF8810480BC8915BEAF8CD540%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfES%3Dr9KLU37ZFfV7ujuS4gjDmPccEuk%2BNnGmg0GvYZCw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1ef301d67bf2%24e9099630%24bb1cc290%24%40pdinc.us.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcfDgExQ_Dq0fmFqq7cdk51sAuKQPpG97raRfR6JwjifA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/YTOPR0101MB231531FEA65DBE1914E14D9FCD550%40YTOPR0101MB2315.CANPRD01.PROD.OUTLOOK.COM.


 

--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVevYf_T0dCfYF6uMBgK0C4vJNV-jHa2DFqsV9wGtuRPmg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].


--

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/88df074b-c26d-4719-ac73-15f44153b410n%40googlegroups.com.