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

Git fetch fails on Windows as service, succeeds as JNLP slave

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: other
    • Labels:
      None
    • Similar Issues:

      Description

      I launched agent from browser on slave (node slave agent) and job builds correctly.
      But when I install "as a service", service started good and jenkins master will see this node is active, then job starts but it can not fetch git repository. Why slave agent work fine, but service work incorrectly?
      Please help to configure service on Windows Server 2008 x86 (Amazon).
      Here is the job console:

      Started by user User
      [EnvInject] - Loading node environment variables.
      Building remotely on windows_x86 (Windows_x86) in workspace D:\Jenkins_workspace
      > C:\Program Files\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      > C:\Program Files\Git\cmd\git.exe config remote.origin.url https://my_repo/scm/git/git_RB3 # timeout=10
      Fetching upstream changes from https://my_repo/scm/git/git_RB3
      > C:\Program Files\Git\cmd\git.exe --version # timeout=10
      using .gitcredentials to set credentials
      > C:\Program Files\Git\cmd\git.exe config --local credential.username builduser # timeout=10
      > C:\Program Files\Git\cmd\git.exe config --local credential.helper store --file=\"C:\Users\jenkins\AppData\Local\Temp\git2110423309356276453.credentials\" # timeout=10
      > C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress https://my_repo/scm/git/git_RB3 +refs/heads/:refs/remotes/origin/
      ERROR: Timeout after 10 minutes
      > C:\Program Files\Git\cmd\git.exe config --local --remove-section credential # timeout=10
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://my_repo/scm/git/git_RB3
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
      at hudson.scm.SCM.checkout(SCM.java:485)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
      at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
      at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
      at hudson.model.Run.execute(Run.java:1738)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:410)
      Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe -c core.askpass=true fetch --tags --progress https://my_repo/scm/git/git_RB3 +refs/heads/:refs/remotes/origin/" returned status code -1:
      stdout:
      stderr:
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1719)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1463)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:63)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:314)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
      at hudson.remoting.UserRequest.perform(UserRequest.java:120)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:332)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at hudson.remoting.Engine$1$1.run(Engine.java:85)
      at java.lang.Thread.run(Unknown Source)
      at ......remote call to windows_x86(Native Method)
      at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
      at hudson.remoting.UserResponse.retrieve(UserRequest.java:220)
      at hudson.remoting.Channel.call(Channel.java:781)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
      at com.sun.proxy.$Proxy60.execute(Unknown Source)
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:808)
      ... 11 more
      ERROR: null
      Finished: FAILURE

        Attachments

          Issue Links

            Activity

            Hide
            jblaine Jeff Blaine added a comment -

            Just want to point out that this is still a problem. Git for Windows 2.11 and 2.12 (at least) install by default with the option for using the Windows Credential Manager ON. I'm pretty sure your standard "accept defaults" Git installs on Windows build nodes will not work with Jenkins jobs targeting password-protected https repositories. Perhaps this should be mentioned in the Git-client Plugin's page until it's addressed?

            Show
            jblaine Jeff Blaine added a comment - Just want to point out that this is still a problem. Git for Windows 2.11 and 2.12 (at least) install by default with the option for using the Windows Credential Manager ON. I'm pretty sure your standard "accept defaults" Git installs on Windows build nodes will not work with Jenkins jobs targeting password-protected https repositories. Perhaps this should be mentioned in the Git-client Plugin's page until it's addressed?
            Hide
            markewaite Mark Waite added a comment -

            Jeff Blaine I think that is a very good suggestion. Could you add that note to the git client plugin wiki page?

            Refer to JENKINS-20356 as another location discussing complications due to service interactions with command line git authentication.

            Show
            markewaite Mark Waite added a comment - Jeff Blaine I think that is a very good suggestion. Could you add that note to the git client plugin wiki page? Refer to JENKINS-20356 as another location discussing complications due to service interactions with command line git authentication.
            Hide
            mletterle Michael Letterle added a comment - - edited

            The following settings should allow the Windows Credential Manager to be used in non-interactive mode:

            git config --global credential.modalprompt false 
            git config --global credential.interactive never

             

            See: 

            https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Faq.md#q-why-does-my-gui-freeze-when-i-push-pull-or-fetch
            https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Configuration.md#interactive

            Show
            mletterle Michael Letterle added a comment - - edited The following settings should allow the Windows Credential Manager to be used in non-interactive mode: git config --global credential.modalprompt false  git config --global credential.interactive never   See:  https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Faq.md#q-why-does-my-gui-freeze-when-i-push-pull-or-fetch https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Configuration.md#interactive
            Hide
            markewaite Mark Waite added a comment -

            Thanks Michael Letterle, that looks very promising. Since the Jenkins git client uses git init to create a repository before it populates it, I think the Jenkins git client could also define those two settings as settings for the specific repository it creates.

            Are there cases you can envision where those settings might be undesirable in a Jenkins workspace?

            Show
            markewaite Mark Waite added a comment - Thanks Michael Letterle , that looks very promising. Since the Jenkins git client uses git init to create a repository before it populates it, I think the Jenkins git client could also define those two settings as settings for the specific repository it creates. Are there cases you can envision where those settings might be undesirable in a Jenkins workspace?
            Hide
            mletterle Michael Letterle added a comment -

            Mark Waite The only issue I could see is if someone wished to manually pull/push from the workspace repo using a different set of credentials, in which case they could manually change the config file for the repo I would think.

            Setting the options globally under the service jenkins runs as has worked well on our build servers for a while now, but if the plugin itself can make those settings per repo, that would be awesome!

            Show
            mletterle Michael Letterle added a comment - Mark Waite The only issue I could see is if someone wished to manually pull/push from the workspace repo using a different set of credentials, in which case they could manually change the config file for the repo I would think. Setting the options globally under the service jenkins runs as has worked well on our build servers for a while now, but if the plugin itself can make those settings per repo, that would be awesome!

              People

              • Assignee:
                Unassigned
                Reporter:
                14163314 Serg Pr
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: