Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-47331

1.37 slave launcher prefixing breaks installations without prefix strings.

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • ec2-plugin
    • None
    • 1.37

      After upgrading to 1.37, none of my spot instances would register with jenkins as a node.

      1.37 introduced the ability to add a prefix command before the launchstring for EC2UnixLaunchers (https://github.com/jenkinsci/ec2-plugin/pull/224), however if one is not using a prefix command, it breaks the launch string somehow.  The logs were showing two spaces in front of the command. 

      INFO: Launching slave agent (via Trilead SSH2 Connection):  java  -jar /tmp/slave.jar

      And when I would ssh into the slaves, there was no slave.jar running.

       

      So I patched out the prefix string here: 

      https://github.com/jenkinsci/ec2-plugin/blob/d5fbd012bf0c18e85ee85653694cf6c51ad4cd3b/src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java#L218

      To remove the prefix part:

      String launchString = "java " + (jvmopts != null ? jvmopts : "") + " -jar " + tmpDir + "/slave.jar";

      then I repackaged the plugin, upgraded to my bespoke version, and everything was working again.

      Im not sure if this is a weird bug with the trilead ssh client that doesnt like commands to be prefixed with spaces or what, but at least that fixed the issue allowing me to use 1.37

          [JENKINS-47331] 1.37 slave launcher prefixing breaks installations without prefix strings.

          marc young added a comment -

          Curious if this is related to JENKINS-46869 and JENKINS-47130

          marc young added a comment - Curious if this is related to JENKINS-46869 and JENKINS-47130

          Joël Schaerer added a comment - Is https://serverfault.com/questions/880623/jenkins-ec2-plugin-http-error-404/882851#882851 the same issue?

          Code changed in jenkins
          User: francisu
          Path:
          src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java
          http://jenkins-ci.org/commit/ec2-plugin/8a832148489403be4b57d854c77968a49f8da31b
          Log:
          JENKINS-47331 Fails to launch from configurations before the specification of prefixString

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: francisu Path: src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java http://jenkins-ci.org/commit/ec2-plugin/8a832148489403be4b57d854c77968a49f8da31b Log: JENKINS-47331 Fails to launch from configurations before the specification of prefixString

          Code changed in jenkins
          User: francisu
          Path:
          http://jenkins-ci.org/commit/ec2-plugin/c82e84bf676554ce7c931e20ca786e22b47c0196
          Log:
          Merge remote-tracking branch 'remotes/origin/master' into JENKINS-47331

          Compare: https://github.com/jenkinsci/ec2-plugin/compare/8a8321484894...c82e84bf6765

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: francisu Path: http://jenkins-ci.org/commit/ec2-plugin/c82e84bf676554ce7c931e20ca786e22b47c0196 Log: Merge remote-tracking branch 'remotes/origin/master' into JENKINS-47331 Compare: https://github.com/jenkinsci/ec2-plugin/compare/8a8321484894...c82e84bf6765

          Francis Upton added a comment -

          Is https://serverfault.com/questions/880623/jenkins-ec2-plugin-http-error-404/882851#882851 the same issue?

          No, I updated server fault to have it refer to the correct issue.

          Curious if this is related to JENKINS-46869 and JENKINS-47130

          Maybe actually. In fact when I think about it, the leading spaces before the "java" command might be a red herring. Maybe the filer of this issue also recreated their configuration? In any case, I'm fixing this issue by adding the "trim()".

           

          Francis Upton added a comment - Is https://serverfault.com/questions/880623/jenkins-ec2-plugin-http-error-404/882851#882851 the same issue? No, I updated server fault to have it refer to the correct issue. Curious if this is related to JENKINS-46869 and JENKINS-47130 Maybe actually. In fact when I think about it, the leading spaces before the "java" command might be a red herring. Maybe the filer of this issue also recreated their configuration? In any case, I'm fixing this issue by adding the "trim()".  

          Code changed in jenkins
          User: Francis Upton IV
          Path:
          src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java
          http://jenkins-ci.org/commit/ec2-plugin/8dceeef40efbbe4e08c73061b00f885105e70fed
          Log:
          JENKINS-47331 Problem with leading spaces in slaveCommandPrefix (#247)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Francis Upton IV Path: src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java http://jenkins-ci.org/commit/ec2-plugin/8dceeef40efbbe4e08c73061b00f885105e70fed Log: JENKINS-47331 Problem with leading spaces in slaveCommandPrefix (#247)

          Code changed in jenkins
          User: francisu
          Path:
          src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java
          http://jenkins-ci.org/commit/ec2-plugin/c2004f087fd1d80d99ed478708fed32bac1fca5d
          Log:
          JENKINS-47331 Fails to launch from configurations before the specification of prefixString (test removal)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: francisu Path: src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java http://jenkins-ci.org/commit/ec2-plugin/c2004f087fd1d80d99ed478708fed32bac1fca5d Log: JENKINS-47331 Fails to launch from configurations before the specification of prefixString (test removal)

          Code changed in jenkins
          User: francisu
          Path:
          src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java
          http://jenkins-ci.org/commit/ec2-plugin/f01cc69e5120a2b5c6a3d043b1ab613d202a73ee
          Log:
          JENKINS-47331 Fails to launch from configurations before the specification of prefixString (try another way)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: francisu Path: src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java http://jenkins-ci.org/commit/ec2-plugin/f01cc69e5120a2b5c6a3d043b1ab613d202a73ee Log: JENKINS-47331 Fails to launch from configurations before the specification of prefixString (try another way)

            francisu Francis Upton
            mixologic Ryan Aslett
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: