jenkinsci / jenkinsci/branch-api-plugin

[JENKINS-70408] Pass exact SCM revision from webhook

Open
#774 5 comments 0 reactions 0 assignees View on GitHub
component:branch-api-plugin component:scm-api-plugin imported-jira-issue priority:major resolution:unresolved
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


  • status: Open
  • priority: Major
  • component(s): branch-api-plugin, scm-api-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 20251211-141027

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.