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

Jenkins Window slave can not fetch from bitbucket

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: git-plugin
    • Environment:
      Jenkins Slave on a Window Server 2008 R2, Service Pack1. 64-bit.
    • Similar Issues:

      Description

      I have a Jenkins Master running on a linux box. Several jobs clone repos from Bitbucket but I have a Windows slave which fails with the following error:

      Building remotely on slavewin-WIN-9G6KGDM45N7-7b265e7f (swarm slavewin) in workspace D:\workspace\SYS-TEST
       > C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > C:\Program Files\Git\bin\git.exe config remote.origin.url ssh://git@XXX.git # timeout=10
      Fetching upstream changes from ssh://git@git.XXX.git
       > C:\Program Files\Git\bin\git.exe --version # timeout=10
      using GIT_SSH to set credentials rsa / deploy keys
       > C:\Program Files\Git\bin\git.exe fetch --tags --progress ssh://git@XXX.git +refs/heads/*:refs/remotes/origin/*
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from ssh://git@XXX.git
      	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
      	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
      	at hudson.scm.SCM.checkout(SCM.java:504)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
      	at hudson.model.Run.execute(Run.java:1819)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --progress ssh://git@XXX.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
      stdout: 
      stderr: /c: /c: Is a directory
      fatal: Could not read from remote repository.
      
      Please make sure you have the correct access rights
      and the repository exists.
      

      The job is configured passing the credential.
      On the Windows side I have installed git-bash:

       $ git --version
      git version 2.19.1.windows.1

      and set these environment variables:

      GIT_SSH=C:\Program Files\Git\usr\bin\ssh.exe
      Path=blablabla:C:\Program Files\Git\cmd

      If I add the private key in users home/.ssh and type git commands to clone, fetch,etc on the Windows it works. However, when launching the Jenkins job from Master UI it return above error. 
      From Jenkins Master I have this:

      -bash-4.2$ git --version
      git version 2.18.0
      
      and Jenkins git-client ver 3.9.1

      Curiously it was working few days ago but we are not able to identify what changed on Jenkins that make everything crashing when running this slave.
       

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment - - edited

          Please use chat or the mailing list to request help with questions related to configuration and authentication. Bug reports are seen by far fewer people than questions in chat and in the mailing list.

          Since there was no change in the git plugin or the git client plugin in the time between when it was working and when it was not working, that seems to be a further indication it is not a bug in the git plugin or the git client plugin.

          Setting GIT_SSH on the windows agent is unnecessary and should probably not be done. Unless you have some compelling reason that you can explain in detail for setting that environment variable, you should leave it unset.

          Show
          markewaite Mark Waite added a comment - - edited Please use chat or the mailing list to request help with questions related to configuration and authentication. Bug reports are seen by far fewer people than questions in chat and in the mailing list. Since there was no change in the git plugin or the git client plugin in the time between when it was working and when it was not working, that seems to be a further indication it is not a bug in the git plugin or the git client plugin. Setting GIT_SSH on the windows agent is unnecessary and should probably not be done. Unless you have some compelling reason that you can explain in detail for setting that environment variable, you should leave it unset.
          Hide
          xfustero Xavier Fustero added a comment - - edited

          Hi Mark Waite,

           

          thanks for looking at it. I looked for an answer to the mailing list first but I couldn't find an answer. Similar problems but different. 
          I have removed the GIT_SSH from Windows but getting the same error. I set it as I saw the Jenkins Job said:

           Fetching upstream changes from ssh://git@XXX.git
           > C:\Program Files\Git\bin\git.exe --version # timeout=10
           using GIT_SSH to set credentials rsa / deploy keys

          and probably I read someone suggesting to set it in Windows to that value.

          I see you close it but just wanted to note I am using Jenkins 2.138.2 in case someone else is reading it.

          Show
          xfustero Xavier Fustero added a comment - - edited Hi Mark Waite ,   thanks for looking at it. I looked for an answer to the mailing list first but I couldn't find an answer. Similar problems but different.  I have removed the GIT_SSH from Windows but getting the same error. I set it as I saw the Jenkins Job said: Fetching upstream changes from ssh://git@XXX.git > C:\Program Files\Git\bin\git.exe --version # timeout=10 using GIT_SSH to set credentials rsa / deploy keys and probably I read someone suggesting to set it in Windows to that value. I see you close it but just wanted to note I am using Jenkins 2.138.2 in case someone else is reading it.
          Hide
          xfustero Xavier Fustero added a comment - - edited

          I have checked the swarm process and it runs under SYSTEM user in windows. This user refers to

          C:\Windows\System32\config\systemprofile\

          I have created the .ssh directory under above dir and copied the private key. I go to Jenkins job and remove Git from Source Code Management and add creating "Execute Windows Batch command" in in Build section. I put the following command there:

          git clone ssh://git@XXX.git

          This worked and cloned the repo under my worksapce D:\workspaces\SYS-TEST successfully

          However, when using the Source Code Management I get the error from the description. 

          Mark, I reopen it to see if you can take a look again and explain why it works one way but not the other way.

          Thanks

          Show
          xfustero Xavier Fustero added a comment - - edited I have checked the swarm process and it runs under SYSTEM user in windows. This user refers to C:\Windows\System32\config\systemprofile\ I have created the .ssh directory under above dir and copied the private key. I go to Jenkins job and remove Git from  Source Code Management  and add creating "Execute Windows Batch command" in in Build section. I put the following command there: git clone ssh://git@XXX.git This worked and cloned the repo under my worksapce D:\workspaces\SYS-TEST successfully However, when using the Source Code Management I get the error from the description.  Mark, I reopen it to see if you can take a look again and explain why it works one way but not the other way. Thanks
          Hide
          markewaite Mark Waite added a comment -

          While I appreciate that you would like me to investigate the specifics of your configuration, I won't do that. When I spend time on topics where others could help, I am sacrificing time on things where I am one of very few that can something.

          This is not a bug. Please work through the configuration questions with others, outside a bug report.

          Show
          markewaite Mark Waite added a comment - While I appreciate that you would like me to investigate the specifics of your configuration, I won't do that. When I spend time on topics where others could help, I am sacrificing time on things where I am one of very few that can something. This is not a bug. Please work through the configuration questions with others, outside a bug report.
          Hide
          xfustero Xavier Fustero added a comment -

          If anyone has the same problem try using jgit instead. Without changing anything on the Windows slave it worked. 

          Show
          xfustero Xavier Fustero added a comment - If anyone has the same problem try using jgit instead. Without changing anything on the Windows slave it worked. 

            People

            • Assignee:
              markewaite Mark Waite
              Reporter:
              xfustero Xavier Fustero
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: