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

Multibranch pipeline: Incorrect branch sort order for plain Git sources

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      1.11.0

      Description

      The sort order of branches in the "Branches" view depends on the SCM source that is configured for a project.  "git-source.png" and "github-source.png" (see attached screenshots) show the same multibranch project. The only difference is the branch source, which is configured as a Git source and GitHub source respectively.

      This is likely due to the fact that in case of a Git source, the branch comparator in BranchContainerImpl breaks, because pipeline.getBranch() always returns null, due to the fact that a Git scm source usually doesn't have an associated ObjectMetadataAction (and no PrimaryInstanceMetadataAction for most branches) while a GitHub source does (see BranchImpl.Branch.getBranch() and Caches.BranchCacheLoader.load(String))

        Attachments

          Activity

          Hide
          halkeye Gavin Mogan added a comment -

          hi Andreas Frischknecht I'm prepping a PR for this right now. It looks like once getBranch is populated, it still sorts by last run before it sorts by name. So it won't look exactly like the screenshot. Hopefully thats okay, either way I think its an improvement.

          Show
          halkeye Gavin Mogan added a comment - hi Andreas Frischknecht I'm prepping a PR for this right now. It looks like once getBranch is populated, it still sorts by last run before it sorts by name. So it won't look exactly like the screenshot. Hopefully thats okay, either way I think its an improvement.
          Show
          halkeye Gavin Mogan added a comment - https://github.com/jenkinsci/blueocean-plugin/pull/1880
          Hide
          romp13 Romain Prévost added a comment -

          Hi Gavin Mogan,

          I'm a colleague of Andreas Frischknecht . I just realized that we forgot to link our PR when we created this ticket.

          You can find it here: https://github.com/jenkinsci/blueocean-plugin/pull/1846

          Your solution is more complete, but you might still be interested.

          About your comment: yes, it sorts by date not by name, but at least master will be at the top as well as favorites which for us is the most important (lot of branches in our project, so each dev wants to favorite its branches and does not care about the others)

          Looking forward to get this fixed.

          Thanks!

           

          Show
          romp13 Romain Prévost added a comment - Hi Gavin Mogan , I'm a colleague of Andreas Frischknecht  . I just realized that we forgot to link our PR when we created this ticket. You can find it here: https://github.com/jenkinsci/blueocean-plugin/pull/1846 Your solution is more complete, but you might still be interested. About your comment: yes, it sorts by date not by name, but at least master will be at the top as well as favorites which for us is the most important (lot of branches in our project, so each dev wants to favorite its branches and does not care about the others) Looking forward to get this fixed. Thanks!  
          Hide
          cb_gavinmogan Dont Use added a comment -

          hey Keith Zantow / Ivan Meredith, can you weigh in on this one at all

          Show
          cb_gavinmogan Dont Use added a comment - hey Keith Zantow / Ivan Meredith , can you weigh in on this one at all
          Hide
          imeredith Ivan Meredith added a comment -

          I have no opinions here really. It does seem reasonable that master is at the top though, although it breaks ordering. Ideally there would be several ways to sort but there is not, so whatever you think is best is probably ok

          Show
          imeredith Ivan Meredith added a comment - I have no opinions here really. It does seem reasonable that master is at the top though, although it breaks ordering. Ideally there would be several ways to sort but there is not, so whatever you think is best is probably ok
          Hide
          halkeye Gavin Mogan added a comment -

          Romain Prévost finally was able to create tests, so if you feel like doing so, do a review https://github.com/jenkinsci/blueocean-plugin/pull/1880

          Show
          halkeye Gavin Mogan added a comment - Romain Prévost finally was able to create tests, so if you feel like doing so, do a review  https://github.com/jenkinsci/blueocean-plugin/pull/1880

            People

            • Assignee:
              halkeye Gavin Mogan
              Reporter:
              afrischke Andreas Frischknecht
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: