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

Git Plugin 3.9.2 ignores agent local tool definition

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
    • Environment:
    • Similar Issues:

      Description

      We are facing issue with latest Git 3.9.2

       

       

      gitTool = tool name: 'GitClient', type: 'git'
      [...]
      execute("\"${gitTool}\" init --bare")
      

       

       

      This triggers the following

       
      **

      07:33:41 using credential bdcfb1c1-c930-4ed5-ad55-b459b1540670
      07:33:41 Cloning the remote Git repository
      07:33:41 Cloning with configured refspecs honoured and without tags
      07:33:41 ERROR: Error cloning remote repo 'origin'
      07:33:41 hudson.plugins.git.GitException: Could not init C:\Jenkins2\workspace\XXX\XXX
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:813)
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:605)
      07:33:41 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
      07:33:41 	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
      07:33:41 	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
      07:33:41 	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      07:33:41 	at hudson.remoting.Request$2.run(Request.java:369)
      07:33:41 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      07:33:41 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      07:33:41 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      07:33:41 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      07:33:41 	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)
      07:33:41 	at java.lang.Thread.run(Thread.java:748)
      07:33:41 	Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from uksndvjen2.usr.XXXX.loc/10.16.2.29:54736
      07:33:41 		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
      07:33:41 		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
      07:33:41 		at hudson.remoting.Channel.call(Channel.java:957)
      07:33:41 		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
      07:33:41 		at sun.reflect.GeneratedMethodAccessor803.invoke(Unknown Source)
      07:33:41 		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      07:33:41 		at java.lang.reflect.Method.invoke(Method.java:498)
      07:33:41 		at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132)
      07:33:41 		at com.sun.proxy.$Proxy127.execute(Unknown Source)
      07:33:41 		at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1139)
      07:33:41 		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1179)
      07:33:41 		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
      07:33:41 		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
      07:33:41 		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
      07:33:41 		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      07:33:41 		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      07:33:41 		at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      07:33:41 		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      07:33:41 		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      07:33:41 		... 1 more
      07:33:41 Caused by: hudson.plugins.git.GitException: Error performing command: /usr/bin/git init C:\Jenkins2\workspace\XXX\XXX
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2049)
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2010)
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2006)
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1638)
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:811)
      07:33:41 	... 12 more
      07:33:41 Caused by: java.io.IOException: Cannot run program "/usr/bin/git" (in directory "C:\Jenkins2\workspace\XXX\XXX"): CreateProcess error=2, The system cannot find the file specified
      07:33:41 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      07:33:41 	at hudson.Proc$LocalProc.<init>(Proc.java:249)
      07:33:41 	at hudson.Proc$LocalProc.<init>(Proc.java:218)
      07:33:41 	at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)
      07:33:41 	at hudson.Launcher$ProcStarter.start(Launcher.java:455)
      07:33:41 	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2038)
      07:33:41 	... 16 more
      07:33:41 Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
      07:33:41 	at java.lang.ProcessImpl.create(Native Method)
      07:33:41 	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
      07:33:41 	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
      07:33:41 	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      07:33:41 	... 21 more

       

       

      Lots of thing were introduced between 3.9.1 and 3.9.2 so I struggle to find an explanation for this change of behaviour. Would you please be able to support?

       

       

        Attachments

          Activity

          Hide
          rvangoethem Remi Van Goethem added a comment -

          Jenkins is a Linux machine whereas the builder is a Window machine. It seems like the builder is trying to resolve the Git tool from the wrong location

          Show
          rvangoethem Remi Van Goethem added a comment - Jenkins is a Linux machine whereas the builder is a Window machine. It seems like the builder is trying to resolve the Git tool from the wrong location
          Hide
          markewaite Mark Waite added a comment -

          The tool is doing what you've configured it to do. You've created a tool named GitClient and given an absolute path to that tool as /usr/bin/git without limiting that tool to platforms where that is the absolute path to the tool.

          Windows doesn't place the git executable at /usr/bin/git, so when the tool is referenced that way on Windows, it can't be found. You'll need to either define the tool as git and allow the operating system PATH to locate the tool, or you'll need to define the tool with absolute path and limit it to specific platforms using a label like windows and linux. The platformlabaeler plugin can assign labels to agents automatically based on operating system, in case you choose to use specific tools.

          If this was working in the past and is no longer working, then I suspect the key step in the change was probably an upgrade of the Jenkins version, not an upgrade of the git plugin version. Git plugin 3.9.2 and git plugin 3.9.1 did not change anything related to tool resolution.

          Show
          markewaite Mark Waite added a comment - The tool is doing what you've configured it to do. You've created a tool named GitClient and given an absolute path to that tool as /usr/bin/git without limiting that tool to platforms where that is the absolute path to the tool. Windows doesn't place the git executable at /usr/bin/git , so when the tool is referenced that way on Windows, it can't be found. You'll need to either define the tool as git and allow the operating system PATH to locate the tool, or you'll need to define the tool with absolute path and limit it to specific platforms using a label like windows and linux . The platformlabaeler plugin can assign labels to agents automatically based on operating system, in case you choose to use specific tools. If this was working in the past and is no longer working, then I suspect the key step in the change was probably an upgrade of the Jenkins version, not an upgrade of the git plugin version. Git plugin 3.9.2 and git plugin 3.9.1 did not change anything related to tool resolution.
          Hide
          rvangoethem Remi Van Goethem added a comment - - edited

          I can reproduce this 100% by simply updating Git plugin to 3.9.2 and fix it by downgrading to 3.9.1

          Alternating between Jenkins 2.161 and 2.162 has no effect. I have checked the code between 3.9.1 and 3.9.2 and I also cannot understand what could have caused the issue, hence me creating this ticket.

          Show
          rvangoethem Remi Van Goethem added a comment - - edited I can reproduce this 100% by simply updating Git plugin to 3.9.2 and fix it by downgrading to 3.9.1 Alternating between Jenkins 2.161 and 2.162 has no effect. I have checked the code between 3.9.1 and 3.9.2 and I also cannot understand what could have caused the issue, hence me creating this ticket.
          Hide
          rvangoethem Remi Van Goethem added a comment -

          My worker is configured as expected:

          Show
          rvangoethem Remi Van Goethem added a comment - My worker is configured as expected:
          Hide
          prg0611 Shaun Thompson added a comment - - edited

          I'm running into the same issue as well with 3.9.2 which is fixed by reverting to 3.9.1

          Show
          prg0611 Shaun Thompson added a comment - - edited I'm running into the same issue as well with 3.9.2 which is fixed by reverting to 3.9.1
          Hide
          kansasmann Glenn Herbert added a comment - - edited

          Similar situation. All defined nodes have a Tool Location set for (Git) Default. Works at 3.9.1, but fails at 3.9.2.  It's almost as if its ignoring Tool Locations.

          Show
          kansasmann Glenn Herbert added a comment - - edited Similar situation. All defined nodes have a Tool Location set for (Git) Default. Works at 3.9.1, but fails at 3.9.2.  It's almost as if its ignoring Tool Locations.
          Show
          timo Tim Graham added a comment - https://github.com/jenkinsci/git-plugin/commit/77967dbb349c8d1df02e4a21e0ff9d9e107e94ee may be the cause?
          Hide
          geoff Geoff Dunn added a comment - - edited

          Yeah I think Tim has got it. Doing my own experimentation it seems in 3.9.1 it will ignore the Tool configuration and use /usr/bin/git on my linux slaves. With 3.9.2 it started trying to use the configured (whoops) c:\Program Files etc

          Changing the configuration to just "git" seems to resolve any issues I had. However deleting the tool configuration and it will try and run git.exe on the linux slave (as the tool will put a default value with git.exe)

          Show
          geoff Geoff Dunn added a comment - - edited Yeah I think Tim has got it. Doing my own experimentation it seems in 3.9.1 it will ignore the Tool configuration and use /usr/bin/git on my linux slaves. With 3.9.2 it started trying to use the configured (whoops) c:\Program Files etc Changing the configuration to just "git" seems to resolve any issues I had. However deleting the tool configuration and it will try and run git.exe on the linux slave (as the tool will put a default value with git.exe)
          Hide
          markewaite Mark Waite added a comment - - edited

          Good catch! Thanks Tim Graham for deducing the problem. I'll run some tests with reverting that change or will discuss it with the author of the change, Oleg Nenashev.

          Expect that a git plugin 3.9.3 will be coming soon with a fix for the issue.

          Show
          markewaite Mark Waite added a comment - - edited Good catch! Thanks Tim Graham for deducing the problem. I'll run some tests with reverting that change or will discuss it with the author of the change, Oleg Nenashev . Expect that a git plugin 3.9.3 will be coming soon with a fix for the issue.
          Hide
          markewaite Mark Waite added a comment -

          Fixed in git plugin 3.9.3 released January 30, 2019. Sorry about the regression!

          Show
          markewaite Mark Waite added a comment - Fixed in git plugin 3.9.3 released January 30, 2019. Sorry about the regression!

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rvangoethem Remi Van Goethem
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: