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

When MultiSCM is used to poll git, it will always rebuild if the workspace is cleaned post build.

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We use MultiSCM to check out multiple git repos before building. The polling for changes works fine when the workspace from last build is still present, but if we add a post build action to clean the workspace, MultiSCM will always start a new build even though nothing has changed.

      However, a workaround is to only delete all files in the workspace but leave the workspace directory intact. Then MultiSCM will do the right thing and check for real changes.

      It's pretty easy to reproduce. Make a job that uses MultiSCM to checkout a git repo, then use the Workspace Cleanup plugin to clean it up afterwards and set it to poll for SCM changes every minute. It will start a build every minute even though nothing has changed. But if you use the Git plugin directly, without using MultiSCM as a proxy, it will not build every minute.

        Attachments

          Issue Links

            Activity

            mcmagnus Magnus Berg created issue -
            jwillemsen Johnny Willemsen made changes -
            Field Original Value New Value
            Comment [ Note, I am not a Java person and the code below is not tested at all, but could this be of help, just based on the documentation above. If this is useful, let me know, can create a pull request when that would help. Addition to MultipleSCM.java

                // Only return supportsPolling when all scms do report back that
                // they supports polling
                @Override
                public boolean supportsPolling()
                {
                  for(SCM scm : scms) {
                    if (!scm.supportsPolling()) return false;
                  }
                  return true;
                }

                // When one scm does require a workspace we return true, else
                // we don't need a workspace for polling
                @Override
                public boolean requiresWorkspaceForPolling()
                {
                  for(SCM scm : scms) {
                    if (scm.requiresWorkspaceForPolling()) return true;
                  }
                  return false;
                }
            ]
            scm_issue_link SCM/JIRA link daemon made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            rodrigc Craig Rodrigues made changes -
            Link This issue is related to JENKINS-33824 [ JENKINS-33824 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 159165 ] JNJira + In-Review [ 196008 ]

              People

              Assignee:
              kbell Kevin Bell
              Reporter:
              mcmagnus Magnus Berg
              Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: