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 created issue -
          Kalle Niemitalo made changes -
          Description Original: Forensics API currently [hardcodes DEFAULT_BRANCH = "master"|https://github.com/jenkinsci/forensics-api-plugin/blob/95d289a396e009ff0c165b47a40505d3ca8420bc/src/main/java/io/jenkins/plugins/forensics/reference/ReferenceRecorder.java#L44] 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|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/metadata/PrimaryInstanceMetadataAction.java], [javadoc|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/metadata/PrimaryInstanceMetadataAction.html]) 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 there are multiple such branches, then Forensics API could still fall back to "master".
          New: Forensics API currently [hardcodes DEFAULT_BRANCH = "master"|https://github.com/jenkinsci/forensics-api-plugin/blob/95d289a396e009ff0c165b47a40505d3ca8420bc/src/main/java/io/jenkins/plugins/forensics/reference/ReferenceRecorder.java#L44] 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|https://github.com/jenkinsci/scm-api-plugin/blob/400faa8fd5651731257ff59f53b715dfeede7ede/src/main/java/jenkins/scm/api/metadata/PrimaryInstanceMetadataAction.java], [javadoc|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/metadata/PrimaryInstanceMetadataAction.html]) 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".
          Kalle Niemitalo made changes -
          Link New: This issue depends on JENKINS-38718 [ JENKINS-38718 ]
          Kalle Niemitalo made changes -
          Link New: This issue relates to JENKINS-66672 [ JENKINS-66672 ]
          Kalle Niemitalo made changes -
          Link New: This issue is related to JENKINS-66672 [ JENKINS-66672 ]
          Kalle Niemitalo made changes -
          Link Original: This issue relates to JENKINS-66672 [ JENKINS-66672 ]
          Ulli Hafner made changes -
          Remote Link New: This issue links to "PR #169 (Web Link)" [ 26936 ]
          Ulli Hafner made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Ulli Hafner made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Fixed but Unreleased [ 10203 ] New: Reopened [ 4 ]
          Ulli Hafner made changes -
          Remote Link Original: This issue links to "PR #169 (Web Link)" [ 26936 ]

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

              Created:
              Updated:
              Resolved: