jenkinsci / jenkinsci/git-plugin
[JENKINS-64424] Incorrect behavior of notifyCommit for regex branch spec with $
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
Jenkins 2.270
git-plugin 4.5.0
I have a freestyle project with such config:
Repository URL: git@mygitserver.com:my-repo
Branches to build: **
Build Triggers > Poll SCM is enabled
When I send a notification on http://jenkins/git/notifyCommit - everything works as expected:
```
$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"
Scheduled project
```
When I change branch specifier to a simple regex :.* - everything still works, but when I use end of line sign like :.+foo$ the behavior changes:
```
$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"
Scheduled polling of project
```
Instead of staring new build Jenkins schedules polling of the project and if there are no new commits there will be no build scheduled. I think it's a bit strange that different regex-s lead to different building algorithms. IMHO algorithms should be the same for all regex-s.
This situation connected somehow with Parametrized builds, JENKINS-29574 and this code.
I can try to fix it if someone describe expected behavior with Parametrized builds. Is it possible to use parameters with regex branch spec? Should git-plugin check if branch spec is a regex before searching for parameters?
---
Originally reported by goganchic, imported from: Incorrect behavior of notifyCommit for regex branch spec with $
Raw content of original issue
Jenkins 2.270
git-plugin 4.5.0I have a freestyle project with such config:
Repository URL: git@mygitserver.com:my-repo
Branches to build: **
Build Triggers > Poll SCM is enabledWhen I send a notification on http://jenkins/git/notifyCommit - everything works as expected:
$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"
Scheduled projectWhen I change branch specifier to a simple regex :.* - everything still works, but when I use end of line sign like :.+foo$ the behavior changes:
$ curl "http://jenkins/git/notifyCommit?url=my-repo&branches=master&sha1=some-sha"
Scheduled polling of projectInstead of staring new build Jenkins schedules polling of the project and if there are no new commits there will be no build scheduled. I think it's a bit strange that different regex-s lead to different building algorithms. IMHO algorithms should be the same for all regex-s.
This situation connected somehow with Parametrized builds,
JENKINS-29574and this code.I can try to fix it if someone describe expected behavior with Parametrized builds. Is it possible to use parameters with regex branch spec? Should git-plugin check if branch spec is a regex before searching for parameters?
Contributor guide
Assessment
This issue has not been assessed yet.