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

Git plugin's 'Fast remote polling' uses slave environment, not master environment.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
    • Environment:
      Ubuntu 12.04 master, Windows 2008 R2 slave, git plugin 1.1.20
    • Similar Issues:

      Description

      The 'Fast remote polling' checkbox for git based jobs means that master now executes a speedy 'git ls-remote ...' command rather than having to have the slave clone and fetch a local repository. (I think)

      I've just re-arranged my configuration such that we now have a linux based master and Windows slaves and spent a bunch'o'time trying to puzzle out why the Git SCM Polling log was failing with errors like:

      hudson.plugins.git.GitException: Command "git ls-remote -h git@myserver:myproject.git mybranch" returned status code 128:
      stdout:
      stderr: error: cannot run ssh: No such file or directory
      fatal: unable to fork

      I think I've tracked this down (by patching + re-compiling the git plugin) to the 'EnvVarMap' that is used by the launchCommandIn method of GitAPI being (it would seem) the environment of the slave node (i.e. the PATH element was chock full of windows paths) yet the git command was actually being executed on the master, a linux box. (tested by removing git from the master and watching the git polling log fail 'unable to find git')

      Presumably this is un-intended behaviour, and a hangover from when the git poll used to happen entirely on the slave (assumption)

      A successful workaround is to disable the 'Fast remote polling' option from the job configuration.

        Attachments

          Activity

          Hide
          ciaranj ciaranj added a comment -

          Just to tie the two systems together, I submitted a pull request with a proposed change to adjust this situation here: https://github.com/jenkinsci/git-plugin/pull/75

          Show
          ciaranj ciaranj added a comment - Just to tie the two systems together, I submitted a pull request with a proposed change to adjust this situation here: https://github.com/jenkinsci/git-plugin/pull/75
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          src/main/java/hudson/plugins/git/util/GitUtils.java
          http://jenkins-ci.org/commit/git-plugin/3d9a73d26b129249c51fccfca6060280197b25eb
          Log:
          [FIXED JENKINS-14321] don't reuse last build environment for fast polling

          Compare: https://github.com/jenkinsci/git-plugin/compare/ef3349e6c254...3d9a73d26b12

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/util/GitUtils.java http://jenkins-ci.org/commit/git-plugin/3d9a73d26b129249c51fccfca6060280197b25eb Log: [FIXED JENKINS-14321] don't reuse last build environment for fast polling Compare: https://github.com/jenkinsci/git-plugin/compare/ef3349e6c254...3d9a73d26b12
          Hide
          ciaranj ciaranj added a comment -

          Sorry Nicolas, this fix does not appear to fix the problem that my original pull request did ?

          I've re-submitted a new pull request based on your commit here,
          https://github.com/jenkinsci/git-plugin/pull/102

          Show
          ciaranj ciaranj added a comment - Sorry Nicolas, this fix does not appear to fix the problem that my original pull request did ? I've re-submitted a new pull request based on your commit here, https://github.com/jenkinsci/git-plugin/pull/102
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: ciaranj
          Path:
          src/main/java/hudson/plugins/git/util/GitUtils.java
          http://jenkins-ci.org/commit/git-plugin/df304f7fe1d85798410ad7c3165a7d3cadcb4d05
          Log:
          [FIXES JENKINS-14321] - Do not re-use last build's environment for remote polling

          Fixes, the original 'fix' in 3d9a73d26b129249c51fccfca6060280197b25eb it appears
          that a crucial check on the newly implemented argument wasn't actually implemented.

          I've changed the condition to test this rather than set 'b' to null if reuseLastBuildEnv
          is set to true as 'b' is de-referenced later in the getPollEnvironment method.

          Rather worryingly it appears that the existing code in getPollEnvironment tests at one
          point whether 'b' is null, but then later (outside this test) derefences it anyway, but
          this commit does not make that particular problem any worse.

          Signed-off-by: ciaranj <ciaranj@gmail.com>

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ciaranj Path: src/main/java/hudson/plugins/git/util/GitUtils.java http://jenkins-ci.org/commit/git-plugin/df304f7fe1d85798410ad7c3165a7d3cadcb4d05 Log: [FIXES JENKINS-14321] - Do not re-use last build's environment for remote polling Fixes, the original 'fix' in 3d9a73d26b129249c51fccfca6060280197b25eb it appears that a crucial check on the newly implemented argument wasn't actually implemented. I've changed the condition to test this rather than set 'b' to null if reuseLastBuildEnv is set to true as 'b' is de-referenced later in the getPollEnvironment method. Rather worryingly it appears that the existing code in getPollEnvironment tests at one point whether 'b' is null, but then later (outside this test) derefences it anyway, but this commit does not make that particular problem any worse. Signed-off-by: ciaranj <ciaranj@gmail.com>
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/git/util/GitUtils.java
          http://jenkins-ci.org/commit/git-plugin/18e799814060256cabc7b607c919f356c184352f
          Log:
          Merge pull request #102 from ciaranj/make_fast_poll_use_master_env

          [FIXES JENKINS-14321] - Do not re-use last build's environment for remote polling

          Compare: https://github.com/jenkinsci/git-plugin/compare/90a8af41cabe...18e799814060


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/git/util/GitUtils.java http://jenkins-ci.org/commit/git-plugin/18e799814060256cabc7b607c919f356c184352f Log: Merge pull request #102 from ciaranj/make_fast_poll_use_master_env [FIXES JENKINS-14321] - Do not re-use last build's environment for remote polling Compare: https://github.com/jenkinsci/git-plugin/compare/90a8af41cabe...18e799814060 – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              ciaranj ciaranj
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: