jenkinsci / jenkinsci/branch-api-plugin
[JENKINS-70408] Pass exact SCM revision from webhook
- Dominant language
- Java
- Stars
- 39
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
You would expect that if e.g. a GitHub webhook is delivered mentioning a particular branch/PR commit, then Jenkins upon processing this webhook would schedule one build of that commit.
Instead, the commit identity from the webhook is essentially ignored, and the branch project is simply scheduled to be built, possibly coalescing with other near-simultaneous commits to the same branch depending on timing. When the build starts, the current branch head is looked up, to load Jenkinsfile typically, and only then will the commit be fixed for the remaining duration of the build.
It would be better for MultiBranchProject.scheduleBuild to pass a SCMRevisionAction to the build from the start in the list of actions in the Queue.Item, if it happens to know the SCMRevision (whether from a webhook or branch indexing). Furthermore, SCMRevisionAction should implement Queue.QueueAction to ensure that queue items corresponding to distinct commits are not coalesced.
---
Originally reported by
jglick, imported from: Pass exact SCM revision from webhook
Raw content of original issue
You would expect that if e.g. a GitHub webhook is delivered mentioning a particular branch/PR commit, then Jenkins upon processing this webhook would schedule one build of that commit.
Instead, the commit identity from the webhook is essentially ignored, and the branch project is simply scheduled to be built, possibly coalescing with other near-simultaneous commits to the same branch depending on timing. When the build starts, the current branch head is looked up, to load Jenkinsfile typically, and only then will the commit be fixed for the remaining duration of the build.
It would be better for MultiBranchProject.scheduleBuild to pass a SCMRevisionAction to the build from the start in the list of actions in the Queue.Item, if it happens to know the SCMRevision (whether from a webhook or branch indexing). Furthermore, SCMRevisionAction should implement Queue.QueueAction to ensure that queue items corresponding to distinct commits are not coalesced.
Contributor guide
Research direction
Start with MultiBranchProject.scheduleBuild and trace how SCMRevisionAction and Queue.Item actions are passed when a webhook or branch indexing provides an SCMRevision. Read Queue.QueueAction behavior as well. Done means known revisions are attached from the start and queue items for distinct commits are not coalesced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100