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

pollSCM always find changes when deleteDir is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • Jenkins ver. 2.107.2 linux docker image

      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()
              }
          }
      }
      

            Unassigned Unassigned
            qinling Leon Qin
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: