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

Support alternative drive letters for Windows ssh agents using PowerShell/Win32-OpenSSH

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • ssh-slaves-plugin
    • None

      I was able to successfully connect the Windows machine with PowerShell/Win32-OpenSSH using the "SSH Build Agents Plugin for Jenkins" using the "Remote root directory" of "C:\jenkins-agent", and I'm able to run Windows builds on this agent.

      The issue occurs when I change the "Remote root directory" to "D:\jenkins-agent", then the agent fails to launch:

      [04/20/19 09:21:28] [SSH] Remote file system root D:\jenkins-agent does not exist. Will try to create it...

      [04/20/19 09:21:28] [SSH] Copying latest remoting.jar...

      [04/20/19 09:21:29] [SSH] Copied 789,283 bytes.
      Expanded the channel window size to 4MB
      [04/20/19 09:21:29] [SSH] Starting agent process: cd "D:\jenkins-agent" && "C:\Program Files (x86)\Java\jre1.8.0_201\bin\java.exe" -jar remoting.jar -workDir D:\jenkins-agent
      Error: Unable to access jarfile remoting.jar
      Slave JVM has terminated. Exit code=1
      [04/20/19 09:21:29] Launch failed - cleaning up connection
      [04/20/19 09:21:29] [SSH] Connection closed.

      The root cause appears to be that the command 'cd "D:\jenkins-agent"' does not successfully change to the D:\ drive, because when using Windows command prompt, you need to add the '/d' argument to the 'cd' command to change the drive:

      /d : Changes the current drive or the current directory for a drive.

          [JENKINS-57126] Support alternative drive letters for Windows ssh agents using PowerShell/Win32-OpenSSH

          Ray Kivisto created issue -
          Ray Kivisto made changes -
          Comment [ I am able to work around this error by adding a "Prefix Start Agent Command" of:

          {{cd /d D:\ && }}

          Then the agent will connect successfully, and I'm able to run Windows builds on this agent. ]
          Ray Kivisto made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Ivan Fernandez Calvo made changes -
          Remote Link New: This issue links to "Instructions in the troubleshooting guide (Web Link)" [ 23264 ]
          Ray Kivisto made changes -
          Link New: This issue duplicates JENKINS-55362 [ JENKINS-55362 ]
          Ray Kivisto made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: In Progress [ 3 ] New: Closed [ 6 ]
          Ray Kivisto made changes -
          Description Original: I was able to successfully connect the Windows machine with PowerShell/Win32-OpenSSH using the "SSH Slaves plugin" using the "Remote root directory" of "C:\jenkins-agent", and I'm able to run Windows builds on this agent.

          The issue occurs when I change the "Remote root directory" to "D:\jenkins-agent", then the agent fails to launch:
          {quote}
           [04/20/19 09:21:28] [SSH] Remote file system root D:\jenkins-agent does not exist. Will try to create it...

          [04/20/19 09:21:28] [SSH] Copying latest remoting.jar...

          [04/20/19 09:21:29] [SSH] Copied 789,283 bytes.
           Expanded the channel window size to 4MB
           [04/20/19 09:21:29] [SSH] Starting agent process: cd "D:\jenkins-agent" && "C:\Program Files (x86)\Java\jre1.8.0_201\bin\java.exe" -jar remoting.jar -workDir D:\jenkins-agent
           Error: Unable to access jarfile remoting.jar
           Slave JVM has terminated. Exit code=1
           [04/20/19 09:21:29] Launch failed - cleaning up connection
           [04/20/19 09:21:29] [SSH] Connection closed.


          {quote}
          The root cause appears to be that the command 'cd "D:\jenkins-agent"' does not successfully change to the D:\ drive, because when using Windows command prompt, you need to add the '/d' argument to the 'cd' command to change the drive:
          {quote}
           /d : Changes the current drive or the current directory for a drive.
          {quote}
          New: I was able to successfully connect the Windows machine with PowerShell/Win32-OpenSSH using the "[SSH Build Agents Plugin for Jenkins|https://github.com/jenkinsci/ssh-slaves-plugin]" using the "Remote root directory" of "C:\jenkins-agent", and I'm able to run Windows builds on this agent.

          The issue occurs when I change the "Remote root directory" to "D:\jenkins-agent", then the agent fails to launch:
          {quote}[04/20/19 09:21:28] [SSH] Remote file system root D:\jenkins-agent does not exist. Will try to create it...

          [04/20/19 09:21:28] [SSH] Copying latest remoting.jar...

          [04/20/19 09:21:29] [SSH] Copied 789,283 bytes.
           Expanded the channel window size to 4MB
           [04/20/19 09:21:29] [SSH] Starting agent process: cd "D:\jenkins-agent" && "C:\Program Files (x86)\Java\jre1.8.0_201\bin\java.exe" -jar remoting.jar -workDir D:\jenkins-agent
           Error: Unable to access jarfile remoting.jar
           Slave JVM has terminated. Exit code=1
           [04/20/19 09:21:29] Launch failed - cleaning up connection
           [04/20/19 09:21:29] [SSH] Connection closed.
          {quote}
          The root cause appears to be that the command 'cd "D:\jenkins-agent"' does not successfully change to the D:\ drive, because when using Windows command prompt, you need to add the '/d' argument to the 'cd' command to change the drive:
          {quote}/d : Changes the current drive or the current directory for a drive.
          {quote}

            rkivisto Ray Kivisto
            rkivisto Ray Kivisto
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: