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

git checkout over ssh fails on windows agents started from msys2 - missing bat file

    Details

    • Similar Issues:

      Description

      While setting up a new windows build slave on a rented virtual windows server (tried  server2012 as well as server2016) I keep running into this problem where Jenkins jobs cannot check out from git on the new agent:

      stderr: error: cannot run c:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7559664601978999582.bat: No such file or directory

      The required batch file is actually produced and quickly deleted again by the jenkins slave. A script I wrote was able to copy the batch file to a different location before it was deleted. It contains:

       

      @echo off
      
      "C:\msys64\usr\bin\ssh.exe" -i "C:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7913781371770019287.key" -l "git" -o "StrictHostKeyChecking=no" %*
      

      The referenced .key file also exists for a short time and contains the correct private key for the git repository.

      It is not clear to me if the file is deleted again before it is invoked, or if it is produced only after it was invoked. I would appreciate pointers how to debug this. Can I introduce wait times after file creation? Since this behaviour is dependent on the windows agent, Windows specific filesystem caching and timing may play a role.

      I was able to reproduce this with three different virtual windows servers: 2 windows cloud servers rented at ionos.de (2012 and 2016) and a 2016 server rented from a different provider. When executing this in a virtualbox windows 10 machine running on top of ubuntu on my own hardware, this issue does not show up.

      Steps to reproduce:

      • Rent a virtual windows server, e.g. from ionos.de
      • Install msys2 and install git and ssh through msys2
      • Install openjdk12 from zip, add to PATH and set JAVA_HOME
      • Define new build agent NEW-WINDOWS-SERVER in Jenkins
      • Start Jenkins slave on windows server like this:
      • Create test job in Jenkins, which checks out a git repository from a git repository over ssh (somethingj like ssh://git@example.com/example-repo)
      • The build steps do not matter, add something simple
      • Build now

      attaching the complete console output. Jenkins version: 2.177. Git client plugin version: 2.7.7

        Attachments

          Activity

          t_herzke_2017 T Herzke created issue -
          t_herzke_2017 T Herzke made changes -
          Field Original Value New Value
          Description While setting up a new windows build slave on a rented virtual windows server (tried  server2012 as well as server2016) I keep running into this problem where Jenkins jobs cannot check out from git on the new agent:

          stderr: error: cannot run c:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7559664601978999582.bat: No such file or directory

          The required batch file is actually produced and quickly deleted again by the jenkins slave. A script I wrote was able to copy the batch file to a different location before it was deleted. It contains:

           
          {code:java}
          @echo off

          "C:\msys64\usr\bin\ssh.exe" -i "C:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7913781371770019287.key" -l "git" -o "StrictHostKeyChecking=no" %*
          {code}
          The referenced .key file also exists for a short time and contains the correct private key for the git repository.

          It is not clear to me if the file is deleted again before it is invoked, or if it is produced only after it was invoked. I would appreciate pointers how to debug this. Can I introduce wait times after file creation? Since this behaviour is dependent on the windows agent, Windows specific filesystem caching and timing may play a role.

          I was able to reproduce this with three different virtual windows servers: 2 windows cloud servers rented at ionos.de (2012 and 2016) and a 2016 server rented from a different provider. When executing this in a virtualbox windows 10 machine running on top of ubuntu on my own hardware, this issue does not show up.

          Steps to reproduce:
           * Rent a virtual windows server, e.g. from ionos.de
           * Install msys2 and install git and ssh through msys2
           * Install openjdk12 from zip, add to PATH and set JAVA_HOME
           * Define new build agent NEW-WINDOWS-SERVER in Jenkins
           * Start Jenkins slave on windows server like this:
           ** start msys2 bash shell
           ** inside bash shell, create ssh tunnel to Jenkins host:
           *** ssh -L 8080:localhost:8080 -L 35900:localhost:35900 -N -f jenkins@my.jenkinshost.example.com
           ** Download slave.jar from Jenkins
           *** wget [http://localhost:8080/jnlpJars/slave.jar]
           ** Start Jenkins slave
           *** java -jar slave.jar -jnlpUrl [http://localhost:8080/computer/NEW-WINDOWS-SERVER/slave-agent.jnlp]
           * Create test job in Jenkins, which checks out a git repository from a git repository over ssh (somethingj like ssh://git@example.com/example-repo)
           * The build steps do not matter, add something simple
           * Build now

          attaching the complete console output.
          t_herzke_2017 T Herzke made changes -
          Attachment console.log [ 47414 ]
          t_herzke_2017 T Herzke made changes -
          Description While setting up a new windows build slave on a rented virtual windows server (tried  server2012 as well as server2016) I keep running into this problem where Jenkins jobs cannot check out from git on the new agent:

          stderr: error: cannot run c:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7559664601978999582.bat: No such file or directory

          The required batch file is actually produced and quickly deleted again by the jenkins slave. A script I wrote was able to copy the batch file to a different location before it was deleted. It contains:

           
          {code:java}
          @echo off

          "C:\msys64\usr\bin\ssh.exe" -i "C:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7913781371770019287.key" -l "git" -o "StrictHostKeyChecking=no" %*
          {code}
          The referenced .key file also exists for a short time and contains the correct private key for the git repository.

          It is not clear to me if the file is deleted again before it is invoked, or if it is produced only after it was invoked. I would appreciate pointers how to debug this. Can I introduce wait times after file creation? Since this behaviour is dependent on the windows agent, Windows specific filesystem caching and timing may play a role.

          I was able to reproduce this with three different virtual windows servers: 2 windows cloud servers rented at ionos.de (2012 and 2016) and a 2016 server rented from a different provider. When executing this in a virtualbox windows 10 machine running on top of ubuntu on my own hardware, this issue does not show up.

          Steps to reproduce:
           * Rent a virtual windows server, e.g. from ionos.de
           * Install msys2 and install git and ssh through msys2
           * Install openjdk12 from zip, add to PATH and set JAVA_HOME
           * Define new build agent NEW-WINDOWS-SERVER in Jenkins
           * Start Jenkins slave on windows server like this:
           ** start msys2 bash shell
           ** inside bash shell, create ssh tunnel to Jenkins host:
           *** ssh -L 8080:localhost:8080 -L 35900:localhost:35900 -N -f jenkins@my.jenkinshost.example.com
           ** Download slave.jar from Jenkins
           *** wget [http://localhost:8080/jnlpJars/slave.jar]
           ** Start Jenkins slave
           *** java -jar slave.jar -jnlpUrl [http://localhost:8080/computer/NEW-WINDOWS-SERVER/slave-agent.jnlp]
           * Create test job in Jenkins, which checks out a git repository from a git repository over ssh (somethingj like ssh://git@example.com/example-repo)
           * The build steps do not matter, add something simple
           * Build now

          attaching the complete console output.
          While setting up a new windows build slave on a rented virtual windows server (tried  server2012 as well as server2016) I keep running into this problem where Jenkins jobs cannot check out from git on the new agent:

          stderr: error: cannot run c:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7559664601978999582.bat: No such file or directory

          The required batch file is actually produced and quickly deleted again by the jenkins slave. A script I wrote was able to copy the batch file to a different location before it was deleted. It contains:

           
          {code:java}
          @echo off

          "C:\msys64\usr\bin\ssh.exe" -i "C:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7913781371770019287.key" -l "git" -o "StrictHostKeyChecking=no" %*
          {code}
          The referenced .key file also exists for a short time and contains the correct private key for the git repository.

          It is not clear to me if the file is deleted again before it is invoked, or if it is produced only after it was invoked. I would appreciate pointers how to debug this. Can I introduce wait times after file creation? Since this behaviour is dependent on the windows agent, Windows specific filesystem caching and timing may play a role.

          I was able to reproduce this with three different virtual windows servers: 2 windows cloud servers rented at ionos.de (2012 and 2016) and a 2016 server rented from a different provider. When executing this in a virtualbox windows 10 machine running on top of ubuntu on my own hardware, this issue does not show up.

          Steps to reproduce:
           * Rent a virtual windows server, e.g. from ionos.de
           * Install msys2 and install git and ssh through msys2
           * Install openjdk12 from zip, add to PATH and set JAVA_HOME
           * Define new build agent NEW-WINDOWS-SERVER in Jenkins
           * Start Jenkins slave on windows server like this:
           ** start msys2 bash shell
           ** inside bash shell, create ssh tunnel to Jenkins host:
           *** ssh -L 8080:localhost:8080 -L 35900:localhost:35900 -N -f jenkins@my.jenkinshost.example.com
           ** Download slave.jar from Jenkins
           *** wget [http://localhost:8080/jnlpJars/slave.jar]
           ** Start Jenkins slave
           *** java -jar slave.jar -jnlpUrl [http://localhost:8080/computer/NEW-WINDOWS-SERVER/slave-agent.jnlp]
           * Create test job in Jenkins, which checks out a git repository from a git repository over ssh (somethingj like ssh://git@example.com/example-repo)
           * The build steps do not matter, add something simple
           * Build now

          attaching the complete console output. Jenkins version: 2.177. Git client plugin version: 2.7.7
          | |
          markewaite Mark Waite made changes -
          Description While setting up a new windows build slave on a rented virtual windows server (tried  server2012 as well as server2016) I keep running into this problem where Jenkins jobs cannot check out from git on the new agent:

          stderr: error: cannot run c:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7559664601978999582.bat: No such file or directory

          The required batch file is actually produced and quickly deleted again by the jenkins slave. A script I wrote was able to copy the batch file to a different location before it was deleted. It contains:

           
          {code:java}
          @echo off

          "C:\msys64\usr\bin\ssh.exe" -i "C:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7913781371770019287.key" -l "git" -o "StrictHostKeyChecking=no" %*
          {code}
          The referenced .key file also exists for a short time and contains the correct private key for the git repository.

          It is not clear to me if the file is deleted again before it is invoked, or if it is produced only after it was invoked. I would appreciate pointers how to debug this. Can I introduce wait times after file creation? Since this behaviour is dependent on the windows agent, Windows specific filesystem caching and timing may play a role.

          I was able to reproduce this with three different virtual windows servers: 2 windows cloud servers rented at ionos.de (2012 and 2016) and a 2016 server rented from a different provider. When executing this in a virtualbox windows 10 machine running on top of ubuntu on my own hardware, this issue does not show up.

          Steps to reproduce:
           * Rent a virtual windows server, e.g. from ionos.de
           * Install msys2 and install git and ssh through msys2
           * Install openjdk12 from zip, add to PATH and set JAVA_HOME
           * Define new build agent NEW-WINDOWS-SERVER in Jenkins
           * Start Jenkins slave on windows server like this:
           ** start msys2 bash shell
           ** inside bash shell, create ssh tunnel to Jenkins host:
           *** ssh -L 8080:localhost:8080 -L 35900:localhost:35900 -N -f jenkins@my.jenkinshost.example.com
           ** Download slave.jar from Jenkins
           *** wget [http://localhost:8080/jnlpJars/slave.jar]
           ** Start Jenkins slave
           *** java -jar slave.jar -jnlpUrl [http://localhost:8080/computer/NEW-WINDOWS-SERVER/slave-agent.jnlp]
           * Create test job in Jenkins, which checks out a git repository from a git repository over ssh (somethingj like ssh://git@example.com/example-repo)
           * The build steps do not matter, add something simple
           * Build now

          attaching the complete console output. Jenkins version: 2.177. Git client plugin version: 2.7.7
          | |
          While setting up a new windows build slave on a rented virtual windows server (tried  server2012 as well as server2016) I keep running into this problem where Jenkins jobs cannot check out from git on the new agent:

          stderr: error: cannot run c:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7559664601978999582.bat: No such file or directory

          The required batch file is actually produced and quickly deleted again by the jenkins slave. A script I wrote was able to copy the batch file to a different location before it was deleted. It contains:

           
          {code:java}
          @echo off

          "C:\msys64\usr\bin\ssh.exe" -i "C:\msys64\home\jenkins\jenkins\workspace\test-tools\test@tmp\ssh7913781371770019287.key" -l "git" -o "StrictHostKeyChecking=no" %*
          {code}
          The referenced .key file also exists for a short time and contains the correct private key for the git repository.

          It is not clear to me if the file is deleted again before it is invoked, or if it is produced only after it was invoked. I would appreciate pointers how to debug this. Can I introduce wait times after file creation? Since this behaviour is dependent on the windows agent, Windows specific filesystem caching and timing may play a role.

          I was able to reproduce this with three different virtual windows servers: 2 windows cloud servers rented at ionos.de (2012 and 2016) and a 2016 server rented from a different provider. When executing this in a virtualbox windows 10 machine running on top of ubuntu on my own hardware, this issue does not show up.

          Steps to reproduce:
           * Rent a virtual windows server, e.g. from ionos.de
           * Install msys2 and install git and ssh through msys2
           * Install openjdk12 from zip, add to PATH and set JAVA_HOME
           * Define new build agent NEW-WINDOWS-SERVER in Jenkins
           * Start Jenkins slave on windows server like this:
           ** start msys2 bash shell
           ** inside bash shell, create ssh tunnel to Jenkins host:
           *** ssh -L 8080:localhost:8080 -L 35900:localhost:35900 -N -f jenkins@my.jenkinshost.example.com
           ** Download slave.jar from Jenkins
           *** wget [http://localhost:8080/jnlpJars/slave.jar]
           ** Start Jenkins slave
           *** java -jar slave.jar -jnlpUrl [http://localhost:8080/computer/NEW-WINDOWS-SERVER/slave-agent.jnlp]
           * Create test job in Jenkins, which checks out a git repository from a git repository over ssh (somethingj like ssh://git@example.com/example-repo)
           * The build steps do not matter, add something simple
           * Build now

          attaching the complete console output. Jenkins version: 2.177. Git client plugin version: 2.7.7
          t_herzke_2017 T Herzke made changes -
          Priority Major [ 3 ] Minor [ 4 ]
          markewaite Mark Waite made changes -
          Assignee Mark Waite [ markewaite ]
          markewaite Mark Waite made changes -
          Summary git checkout over ssh fails on some windows agents because .bat file is missing git checkout over ssh fails on windows agents started from msys2 - missing bat file
          t_herzke_2017 T Herzke made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              t_herzke_2017 T Herzke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: