jenkinsci / jenkinsci/git-plugin

[JENKINS-50168] When specifying the branch to poll as part of a parameterized build, git-plugin uses last polled branch instead

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

Description

I have the following Jenkins Pipeline job:



  • Build Trigger: "Poll SCM"

  • Parametrized with String parameter "BRANCH", default value "master"

  • Definition is "Pipeline script from SCM" with Branch Specifier "$BRANCH", "Lightweight checkout" unchecked

Expected behaviour:

The job polls SCM. When changes are detected in the branch specified in the default value of the BRANCH parameter ("master" in this case), the job is triggered.

Actual behaviour:

The job polls SCM, but it ONLY triggers the job when changes are detected in the branch that was last built.

This causes the following issue:

After I manually trigger the job with branch "develop", subsequent changes in branch "master" are ignored.

This issue also manifests itself when Build Trigger: "Build when a change is pushed to BitBucket" is used.

This seems to be a regression of issue https://issues.jenkins-ci.org/browse/JENKINS-27327

---
Originally reported by jeroen_s, imported from: When specifying the branch to poll as part of a parameterized build, git-plugin uses last polled branch instead


  • assignee: jkwiz
  • status: In Review
  • priority: Minor
  • component(s): git-plugin
  • label(s): git, pipeline, scm
  • resolution: Unresolved
  • votes: 4
  • watchers: 8
  • imported: 2025-12-02

Raw content of original issue

I have the following Jenkins Pipeline job:



  • Build Trigger: "Poll SCM"

  • Parametrized with String parameter "BRANCH", default value "master"

  • Definition is "Pipeline script from SCM" with Branch Specifier "$BRANCH", "Lightweight checkout" unchecked

Expected behaviour:
The job polls SCM. When changes are detected in the branch specified in the default value of the BRANCH parameter ("master" in this case), the job is triggered.

Actual behaviour:
The job polls SCM, but it ONLY triggers the job when changes are detected in the branch that was last built.

This causes the following issue:
After I manually trigger the job with branch "develop", subsequent changes in branch "master" are ignored.

This issue also manifests itself when Build Trigger: "Build when a change is pushed to BitBucket" is used.

This seems to be a regression of issue https://issues.jenkins-ci.org/browse/JENKINS-27327

environment

```
jenkins version: 2.89.3

git plugin: 3.8.0

git client plugin version: 2.7.1
```

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.