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

Add an extension point so github et al can expose their default branches via scm api

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • blueocean-plugin

      Github and bitbucket (and likely others) have the concept of a default branch.

      This nominally is "master" by convention with git, but it is common enough for people to make up their own convention. With github you can tell github what the master branch is, and this changes the behavior of the UI somewhat. This is also exposed via the api.

      Given the importance of main/master/default branches in UI, it would be nice to be able to expose this via the respective plugins. The common dependency I believe is scm-api (even though the git implementation won't implement this extension, one of the github ones can, as it depends on git, which depends on scm-api)

          [JENKINS-38718] Add an extension point so github et al can expose their default branches via scm api

          Michael Neale added a comment - - edited

          vivek https://github.com/jenkinsci/scm-api-plugin/pull/15 - not sure if that is the best approach or best place, but is a stab in the dark..

          obviously to make it useful, one of the github plugins will need to implement this extension point (up to you how this is called, may affect where we put extension point)

          Michael Neale added a comment - - edited vivek https://github.com/jenkinsci/scm-api-plugin/pull/15 - not sure if that is the best approach or best place, but is a stab in the dark.. obviously to make it useful, one of the github plugins will need to implement this extension point (up to you how this is called, may affect where we put extension point)

          James Dumay added a comment -

          stephenconnolly would it be possible to get this as a property on a Multibranch Pipeline action?

          James Dumay added a comment - stephenconnolly would it be possible to get this as a property on a Multibranch Pipeline action?

          Stephen Connolly added a comment - https://github.com/jenkinsci/scm-api-plugin/pull/20 is the api implementation

          James Dumay added a comment -

          This is really awesome! Thanks Stephen

          James Dumay added a comment - This is really awesome! Thanks Stephen

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/scm/api/metadata/PrimaryInstanceMetadataAction.java
          http://jenkins-ci.org/commit/scm-api-plugin/a969bee9193e0ddede577a819de4f9732328c7b6
          Log:
          [FIXED JENKINS-38718] Add a metadata action to identify 'primary instances'

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/scm/api/metadata/PrimaryInstanceMetadataAction.java http://jenkins-ci.org/commit/scm-api-plugin/a969bee9193e0ddede577a819de4f9732328c7b6 Log: [FIXED JENKINS-38718] Add a metadata action to identify 'primary instances'

          James Dumay added a comment -

          stephenconnolly I now use PrimaryInstanceMetadataAction to determine "defaultness of the branch" in https://github.com/jenkinsci/blueocean-plugin/pull/707

          Works like a charm!

          James Dumay added a comment - stephenconnolly I now use PrimaryInstanceMetadataAction to determine "defaultness of the branch" in https://github.com/jenkinsci/blueocean-plugin/pull/707 Works like a charm!

            jamesdumay James Dumay
            michaelneale Michael Neale
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: