[CI] Merge PR against its target branch instead of main (#19712)#19775
Conversation
Jenkins' init_git() pre-build step unconditionally merged origin/main into every non-main branch build. For PRs targeting a release branch (e.g. v0.25.0), this merged main's diverged state into the PR and failed with conflicts in web/package.json and web/package-lock.json (main is on 0.25.0-dev1 while v0.25.0 is on 0.25.0), erroring out every CI stage before any build or test ran. Use env.CHANGE_TARGET to merge against the PR's actual target branch, and gate the merge on a PR build (CHANGE_TARGET != null) so direct release branch builds skip merging just like main does. (cherry picked from commit 02280c1)
|
CI on branch v0.25.0 is fixed after merging this PR. The CI of this PR will still fail. |
There was a problem hiding this comment.
Code Review
This pull request updates the Jenkins pipeline configuration to support PR builds targeting branches other than main (such as release branches) by using the target branch of the PR (env.CHANGE_TARGET). The reviewer suggested wrapping the target branch variable in single quotes within the shell script in the template (Prepare.groovy.j2) to prevent potential shell expansion or word splitting issues, and then regenerating the Jenkinsfiles.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Jenkins' init_git() pre-build step unconditionally merged origin/main into every non-main branch build. For PRs targeting a release branch (e.g. v0.25.0), this merged main's diverged state into the PR and failed with conflicts in web/package.json and web/package-lock.json (main is on 0.25.0-dev1 while v0.25.0 is on 0.25.0), erroring out every CI stage before any build or test ran.
Use env.CHANGE_TARGET to merge against the PR's actual target branch, and gate the merge on a PR build (CHANGE_TARGET != null) so direct release branch builds skip merging just like main does.
(cherry picked from commit 02280c1)