-
Improvement
-
Resolution: Fixed
-
Minor
When Jenkins is building pull request (either the source branch or the result of merging), the discoverReferenceBuild and discoverGitReferenceBuild steps could choose a reference build from the job corresponding to the target branch of the pull request, by default. This way, the pipeline would not need to pass in defaultBranch: env.CHANGE_TARGET explicitly.
The precedence could be:
- referenceJob: argument
- target branch of the pull request, from ChangeRequestSCMHead.getTarget()
- defaultBranch: argument
- PrimaryInstanceMetadataAction, if
JENKINS-66689is implemented - hardcoded DEFAULT_BRANCH = "master"
This could be implemented by making ReferenceRecorder in forensics-api-plugin call ChangeRequestSCMHead.getTarget() if available, and use the result as the reference branch, instead of the default branch (which can be set with ReferenceRecorder.setDefaultBranch or defaults to "master"). SimpleReferenceRecorder.setReferenceJob would still bypass the multibranch support altogether, and use exactly the job that you specify.
- is related to
-
JENKINS-66689 Use PrimaryInstanceMetadataAction for choosing default reference branch
- Resolved
-
JENKINS-66480 Reference build is wrong for PRs
- Resolved
-
JENKINS-66581 Implement ChangeRequestSCMHead2 for pull requests
- Closed
- links to