pollSCM always find changes when deleteDir is used

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      My build job is configured to be triggered by pollSCM.  In the post build steps, deleteDir() is set. The problem is that the polling can always find changes.

      The polling log shows

      Started on Jul 26, 2018 12:51:23 AM no polling baseline in /var/jenkins_home/workspace/Temp_Try/Leon/TestPollSCM@libs/pki-common on Using strategy: Default [poll] Last Built Revision: Revision fb232d8879add2865172fe1a501316907ae109ae (refs/remotes/origin/master) Done. Took 6 ms Changes found
      

      Note: there is a Global Pipeline Lib  (pki-common) configured to be implicitly loaded for all projects.

      If I remove deleteDir() step, then pollSCM works fine.

      Following is a simple pipeline to reproduce the issue.

      pipeline {
          agent {
              label 'linux-docker'
          }
          options {
              timeout(time: 4, unit: 'HOURS')
              timestamps()
              buildDiscarder(logRotator(artifactDaysToKeepStr: '2', artifactNumToKeepStr: '5', daysToKeepStr: '15', numToKeepStr: '60'))
          }
          triggers {
              pollSCM('H/2 * * * *')
          }
          stages {
              stage('Checkout') {
                  steps {
                      checkout(poll: true, scm: [$class: 'GitSCM', branches: [[name: "refs/heads/master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'GitLFSPull'], [$class: 'AuthorInChangelog'], [$class: 'RelativeTargetDirectory', relativeTargetDir: "."], [$class: 'PruneStaleBranch'], [$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: true, reference: '', trackingSubmodules: false]], gitTool: 'Default', submoduleCfg: [], userRemoteConfigs: [[credentialsId: "GITHUB-CHEMJENKINS", url: "https://github.com/chemjenkins-pki/sandbox"]]])
                  }
              }
              stage("Test and Package") {
                  steps {
                      sh "ls"
                  }
              }
          }
          post {
              always {
                  deleteDir()
              }
          }
      }
      

            Assignee:
            Unassigned
            Reporter:
            Leon Qin
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: