jenkinsci / jenkinsci/git-plugin
[JENKINS-52746] pollSCM always find changes when deleteDir is used
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
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()
}
}
}
```
---
Originally reported by qinling, imported from: pollSCM always find changes when deleteDir is used
Raw content of original issue
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 foundNote: 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()
}
}
}
- environment:
Jenkins ver. 2.107.2 linux docker image
Contributor guide
Assessment
This issue has not been assessed yet.