-
Improvement
-
Resolution: Fixed
-
Minor
-
None
Forensics API currently hardcodes DEFAULT_BRANCH = "master" as the reference branch if not set with the referenceJob: or defaultBranch: parameter of the discoverReferenceBuild or discoverGitReferenceBuild pipeline step. However, the primary branches in many repositories have been renamed to "main".
Forensics API could search for PrimaryInstanceMetadataAction (source, javadoc) in the SCMHead instances. That would let it find the renamed primary branch without needing extra configuration. If no branch has PrimaryInstanceMetadataAction (because the SCM does not support that, or because the primary branch was excluded from the multibranch project), or if two or more branches have PrimaryInstanceMetadataAction, then Forensics API could still fall back to "master".
- depends on
-
JENKINS-38718 Add an extension point so github et al can expose their default branches via scm api
-
- Resolved
-
- is related to
-
JENKINS-66672 Use pull request target branch for reference build by default
-
- Resolved
-
In principle, Forensics API could still try to disambiguate by excluding SCMHead instances that have PrimaryInstanceMetadataAction but are pull requests according to ChangeRequestSCMHead. However, there is no reason for such complexity if no plugin creates things like that.