jenkinsci / jenkinsci/git-plugin

[JENKINS-50886] Declarative pipeline with pollSCM triggers 2 builds

Open
#3,293 12 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

I have a multibranch declarative pipeline with a pollSCM trigger to poll every 2 minutes. Whenever there is a change to the branch in BitBucket it triggers correctly but about 2 minutes later it triggers again. I'm not sure if this is a bug or some configuration error on my behalf.

 

I've attached a screenshot of the duplicate builds and poll log for one of the duplicate builds. Below is the top of my declarative pipeline for reference to how I am setting it up.

pipeline {

agent none
environment {
APPVERSION = '0.1.0'
NUGET_API_KEY = credentials('build-server-nuget-id-readonly')
}
triggers {
// poll repo every 2 minute for changes
pollSCM('*/2 * * * *')
}
options {
// add timestamps to output
timestamps()
overrideIndexTriggers(false)
buildDiscarder(logRotator(numToKeepStr: '10'))
skipStagesAfterUnstable()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
...
}

 

---
Originally reported by jonathank, imported from: Declarative pipeline with pollSCM triggers 2 builds


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • label(s): bitbucket, declarative, pipeline,, pollscm
  • resolution: Unresolved
  • votes: 6
  • watchers: 10
  • imported: 2025-12-02

Raw content of original issue

I have a multibranch declarative pipeline with a pollSCM trigger to poll every 2 minutes. Whenever there is a change to the branch in BitBucket it triggers correctly but about 2 minutes later it triggers again. I'm not sure if this is a bug or some configuration error on my behalf.

 

I've attached a screenshot of the duplicate builds and poll log for one of the duplicate builds. Below is the top of my declarative pipeline for reference to how I am setting it up.



pipeline {

agent none
environment {
APPVERSION = '0.1.0'
NUGET_API_KEY = credentials('build-server-nuget-id-readonly')
}
triggers {
// poll repo every 2 minute for changes
pollSCM('*/2 * * * *')
}
options {
// add timestamps to output
timestamps()
overrideIndexTriggers(false)
buildDiscarder(logRotator(numToKeepStr: '10'))
skipStagesAfterUnstable()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
...
}


 

environment

```
Official Jenkins Container (on AWS ECS)

Jenkins 2.89.4

Pipeline: Declarative 1.2.8,
```

2 attachments

- [jenkins polling log.txt](https://issues.jenkins.io/secure/attachment/42220/jenkins%20polling%20log.txt)
- [jenkins-duplicate-example.png](https://issues.jenkins.io/secure/attachment/42219/jenkins-duplicate-example.png)
> ![jenkins-duplicate-example.png](https://issues.jenkins.io/secure/attachment/42219/jenkins-duplicate-example.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.