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

Git plugin 2.0: Git polling causes builds even if no changes

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • git-plugin
    • None

        [JENKINS-20767] Git plugin 2.0: Git polling causes builds even if no changes

        Roman Prots' created issue -

        Confirmed. On my system. What additional information is required to investigate this?

        Corey O'Connor added a comment - Confirmed. On my system. What additional information is required to investigate this?

        Mark Waite added a comment -

        Are you using the JGit executable (as described in JENKINS-20286) or are you using the command line executable? The executable is selected from a drop down in the plugin configuration

        I've not been able to find a repeatable case to duplicate the problem when using the Git command line executable, but I see it consistently when using the JGit executable.

        Can you provide a repeatable set of steps which illustrate the problem (and preferably use the Git command line executable)? JENKINS-20286 provides the steps I used to show the problem with the JGit implementation.

        Mark Waite added a comment - Are you using the JGit executable (as described in JENKINS-20286 ) or are you using the command line executable? The executable is selected from a drop down in the plugin configuration I've not been able to find a repeatable case to duplicate the problem when using the Git command line executable, but I see it consistently when using the JGit executable. Can you provide a repeatable set of steps which illustrate the problem (and preferably use the Git command line executable)? JENKINS-20286 provides the steps I used to show the problem with the JGit implementation.

        1. Command line executable. Git version 1.8.4.4

        Other observation: We use the multiple SCMs plugin. Which is known to be problematic. In this case the issue is not isolated to jobs that use that plugin. All jobs are affected.

        I've adding the DisableRemotePoll option to all jobs. This resolved the issue for me. The script I used is:

        import jenkins.model.*;
        import hudson.model.*;
        import hudson.tasks.*;
        import hudson.plugins.git.*;
        import hudson.plugins.git.extensions.impl. DisableRemotePoll;
        
        def updateScm(project, scm) {
            println("updating " + scm.toString() + " for project " + project);
            remote_poll_opt = new DisableRemotePoll();
            scm.extensions.add(remote_poll_opt);
            project.save();
        }
        
        for(project in Hudson.instance.items) {
          scm = project.scm;
          if (scm instanceof org.jenkinsci.plugins.multiplescms.MultiSCM) {
            for(actual_scm in scm.getConfiguredSCMs())
              updateScm(project, (GitSCM)actual_scm);
          } else if (scm instanceof hudson.plugins.git.GitSCM) {
              updateScm(project, (GitSCM)scm);    
          } else {
            println("unknown scm type " + scm.toString());
          }
        }
        

        Corey O'Connor added a comment - Command line executable. Git version 1.8.4.4 Other observation: We use the multiple SCMs plugin. Which is known to be problematic. In this case the issue is not isolated to jobs that use that plugin. All jobs are affected. I've adding the DisableRemotePoll option to all jobs. This resolved the issue for me. The script I used is: import jenkins.model.*; import hudson.model.*; import hudson.tasks.*; import hudson.plugins.git.*; import hudson.plugins.git.extensions.impl. DisableRemotePoll; def updateScm(project, scm) { println("updating " + scm.toString() + " for project " + project); remote_poll_opt = new DisableRemotePoll(); scm.extensions.add(remote_poll_opt); project.save(); } for(project in Hudson.instance.items) { scm = project.scm; if (scm instanceof org.jenkinsci.plugins.multiplescms.MultiSCM) { for(actual_scm in scm.getConfiguredSCMs()) updateScm(project, (GitSCM)actual_scm); } else if (scm instanceof hudson.plugins.git.GitSCM) { updateScm(project, (GitSCM)scm); } else { println("unknown scm type " + scm.toString()); } }

        David Merrill added a comment -

        Remote polling seems to be broken in Git Plugin 2.0. I have worked around it in my environment by using "Force polling within workspace", which is fine as long as I do not also enable "Delete workspace when build is done". Ideally I would want to delete the workspace after a successful build but I can live with this until remote polling works again.

        David Merrill added a comment - Remote polling seems to be broken in Git Plugin 2.0. I have worked around it in my environment by using "Force polling within workspace", which is fine as long as I do not also enable "Delete workspace when build is done". Ideally I would want to delete the workspace after a successful build but I can live with this until remote polling works again.

        The workaround of using "Force polling within workspace", a DisableRemotePoll extension instance, does not work for Build Flow projects. Those no longer initialize a workspace. I believe that is an issue with the build flow plugin.

        Corey O'Connor added a comment - The workaround of using "Force polling within workspace", a DisableRemotePoll extension instance, does not work for Build Flow projects. Those no longer initialize a workspace. I believe that is an issue with the build flow plugin.
        Corey O'Connor made changes -
        Link New: This issue is related to JENKINS-20843 [ JENKINS-20843 ]

        Mark Waite added a comment -

        coreyoconnor when you say "confirmed" do you mean that you used command line or that you used jgit?

        Mark Waite added a comment - coreyoconnor when you say "confirmed" do you mean that you used command line or that you used jgit?

        As indicated in comment #3: command line executable version 1.8.4.4

        Corey O'Connor added a comment - As indicated in comment #3: command line executable version 1.8.4.4

        Mark Waite added a comment -

        While writing tests for the git-client-plugin, I found a bug in the command line git implementation used for remote polling. The bug is fixed in git-client-plugin 1.6.2 which was just released.

        It is worth trying git-client-plugin 1.6.2 to see if it resolves the problem. Refer to https://github.com/jenkinsci/git-client-plugin/commit/e5e75d5a100905c0d5b332bbde3642e96ffe10a9 for more details on the remote polling bug.

        Mark Waite added a comment - While writing tests for the git-client-plugin, I found a bug in the command line git implementation used for remote polling. The bug is fixed in git-client-plugin 1.6.2 which was just released. It is worth trying git-client-plugin 1.6.2 to see if it resolves the problem. Refer to https://github.com/jenkinsci/git-client-plugin/commit/e5e75d5a100905c0d5b332bbde3642e96ffe10a9 for more details on the remote polling bug.

          ndeloof Nicolas De Loof
          rprots Roman Prots'
          Votes:
          15 Vote for this issue
          Watchers:
          30 Start watching this issue

            Created:
            Updated:
            Resolved: