jenkinsci / jenkinsci/git-plugin
[JENKINS-31865] Jenkins builds incorrect branch when regex branch specifier changes
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
Today I noticed what seems to be a bug in Jenkins/git-plugin due to some sort of caching(??)
- create new freestyle project
- use git scm
- specify a regex branch specifier, eg. :origin/master
- save and build
- update project, changing the branch specifier, eg. :origin/yolo
- save and build
- update the project, changing the branch specifier back to the original, eg. :origin/master
- save and build
I'd expect the last build to be master, but it really just checks out the previous branch :origin/yolo.
I came across this when I tried using a parameterized build setup to build multiple branches :origin/(master|v.*) on scm change, with the option to manually specify a branch to build via the parameter. However, after changing the branch specifier in this case, Jenkins/git-plugin seems to get stuck on one branch :o.
Let me know if I can help with any other details.
---
Originally reported by wilrnh, imported from: Jenkins builds incorrect branch when regex branch specifier changes
Raw content of original issue
Today I noticed what seems to be a bug in Jenkins/git-plugin due to some sort of caching(??)
- create new freestyle project
- use git scm
- specify a regex branch specifier, eg. :origin/master
- save and build
- update project, changing the branch specifier, eg. :origin/yolo
- save and build
- update the project, changing the branch specifier back to the original, eg. :origin/master
- save and build
I'd expect the last build to be master, but it really just checks out the previous branch :origin/yolo.
I came across this when I tried using a parameterized build setup to build multiple branches :origin/(master|v.*) on scm change, with the option to manually specify a branch to build via the parameter. However, after changing the branch specifier in this case, Jenkins/git-plugin seems to get stuck on one branch :o.
Let me know if I can help with any other details.
environment
```
git-plugin 2.4.0
Jenkins ver. 1.626
```
Contributor guide
Assessment
This issue has not been assessed yet.