Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66689

Use PrimaryInstanceMetadataAction for choosing default reference branch

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • forensics-api-plugin
    • 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".

          [JENKINS-66689] Use PrimaryInstanceMetadataAction for choosing default reference branch

          Kalle Niemitalo added a comment - - edited

          if two or more branches have PrimaryInstanceMetadataAction, then Forensics API could still fall back to "master”.

          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.

          Kalle Niemitalo added a comment - - edited if two or more branches have PrimaryInstanceMetadataAction, then Forensics API could still fall back to "master”. 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.

            drulli Ulli Hafner
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: