jenkinsci / jenkinsci/git-plugin

[JENKINS-30475] bad design for Polling vs Checkout algorithms

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

Description

After long time of debugging i found that current polling algorithm works in the next way:

Polling:



  1. Get from remote repo branchnames + sha1

  2. compare with existed BuilData from latest build (ONE logic)

  3. If sha1/branch not found -> trigger build (NO RPA attached)

Checkout:



  1. Build is running and it calls checkout() step in GITScm

  2. checkout() calls getBuildRevision that calls DefaultBuildChooser that calls getAdvancedCandidateRevisions() that calls revs = GitUtils.filterTipBranches(revs); (SECOND logic)

  3. filter tips removes all intermediate branches and they never appears in BuildData

That ends in situations that Polling needs branches, but checkout didn't build them.

I fixed this issue by commenting tips filtering https://github.com/KostyaSha/git-plugin/commit/8336202ee5ec8d5a12caa875aeba27b89ac3af58 this allowed build all branches and Polling now satisfied.

Suggestion:



  1. Put RPA for triggered build as polling result -> allows ensure that BuildData will get what polling wants

  2. Use the same logic for checkout and polling -> more or less allows hope that checkout will pick what polling mean

---
Originally reported by integer, imported from: bad design for Polling vs Checkout algorithms


  • status: Open
  • priority: Blocker
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 2
  • watchers: 9
  • imported: 2025-12-02

Raw content of original issue

After long time of debugging i found that current polling algorithm works in the next way:

Polling:



  1. Get from remote repo branchnames + sha1

  2. compare with existed BuilData from latest build (ONE logic)

  3. If sha1/branch not found -> trigger build (NO RPA attached)

Checkout:



  1. Build is running and it calls checkout() step in GITScm

  2. checkout() calls getBuildRevision that calls DefaultBuildChooser that calls getAdvancedCandidateRevisions() that calls revs = GitUtils.filterTipBranches(revs); (SECOND logic)

  3. filter tips removes all intermediate branches and they never appears in BuildData

That ends in situations that Polling needs branches, but checkout didn't build them.
I fixed this issue by commenting tips filtering https://github.com/KostyaSha/git-plugin/commit/8336202ee5ec8d5a12caa875aeba27b89ac3af58 this allowed build all branches and Polling now satisfied.

Suggestion:



  1. Put RPA for triggered build as polling result -> allows ensure that BuildData will get what polling wants

  2. Use the same logic for checkout and polling -> more or less allows hope that checkout will pick what polling mean


environment

```
2.4.0/1.18.0

1.609.3
```

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.