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

Multi-branch pipeline favorited via classic UI has "item" returned as MultiBranchPipelineImpl rather than BranchImpl

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • blueocean-plugin
    • None
    • 1.0-m12

      If a user favorites a multi-branch pipeline via the classic UI, the blue ocean REST API returns the favorited item as an instance of MultibranchPipelineImpl rather than BranchImpl (see JSON below). Ideally the favorites API would be consistent by ensuring the default branch is returning regardless of how the user favorited it.

      vivek Let me know if you want to discuss a different workaround. michaelneale seemed to think this was the right way to approach it but curious what you think.

      {
          "_class": "io.jenkins.blueocean.service.embedded.rest.FavoriteImpl",
          "_links": {
              "self": {
                  "_class": "io.jenkins.blueocean.rest.hal.Link",
                  "href": "/blue/rest/users/cmeyers/favorites/blueocean/"
              }
          },
          "item": {
              "_class": "io.jenkins.blueocean.service.embedded.rest.MultiBranchPipelineImpl",
              "_links": {
                  "self": {
                      "_class": "io.jenkins.blueocean.rest.hal.Link",
                      "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/"
                  },
                  "branches": {
                      "_class": "io.jenkins.blueocean.rest.hal.Link",
                      "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/branches/"
                  },
                  "actions": {
                      "_class": "io.jenkins.blueocean.rest.hal.Link",
                      "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/actions/"
                  },
                  "runs": {
                      "_class": "io.jenkins.blueocean.rest.hal.Link",
                      "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/runs/"
                  },
                  "queue": {
                      "_class": "io.jenkins.blueocean.rest.hal.Link",
                      "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/queue/"
                  }
              },
              "actions": [{
                  "_class": "com.cloudbees.hudson.plugins.folder.relocate.RelocationAction",
                  "_links": {
                      "self": {
                          "_class": "io.jenkins.blueocean.rest.hal.Link",
                          "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/move/"
                      }
                  },
                  "urlName": "move"
              }, {
                  "_class": "org.jenkinsci.plugins.workflow.cps.Snippetizer$LocalAction",
                  "_links": {
                      "self": {
                          "_class": "io.jenkins.blueocean.rest.hal.Link",
                          "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/pipeline-syntax/"
                      }
                  },
                  "urlName": "pipeline-syntax"
              }, {
                  "_class": "com.cloudbees.plugins.credentials.ViewCredentialsAction",
                  "_links": {
                      "self": {
                          "_class": "io.jenkins.blueocean.rest.hal.Link",
                          "href": "/blue/rest/organizations/jenkins/pipelines/blueocean/credentials/"
                      }
                  },
                  "stores": {
                      "folder": {
                          "_class": "com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider$FolderCredentialsProperty$CredentialsStoreActionImpl"
                      }
                  },
                  "urlName": "credentials"
              }],
              "displayName": "blueocean",
              "fullName": "blueocean",
              "name": "blueocean",
              "organization": "jenkins",
              "estimatedDurationInMillis": 9437,
              "numberOfFolders": 0,
              "numberOfPipelines": 17,
              "weatherScore": 0,
              "branchNames": [
                  "feature%2FUX-311",
                  "feature%2FUX-68",
                  "UX-498",
                  "hotfix%2FUX-307",
                  "ux-412",
                  "UX-454",
                  "master",
                  "bug%2FUX-202",
                  "experiment%2Ferrors-interstitials",
                  "feature%2FUX-262-bug-prs",
                  "bug%2FUX-334",
                  "feature%2FUX-495",
                  "UX-257",
                  "UX-301",
                  "bug%2Fgithub-load",
                  "feature%2FUX-181",
                  "UX-439"
              ],
              "numberOfFailingBranches": 17,
              "numberOfFailingPullRequests": 0,
              "numberOfSuccessfulBranches": 0,
              "numberOfSuccessfulPullRequests": 0,
              "totalNumberOfBranches": 17,
              "totalNumberOfPullRequests": 0
          }
      }
      

          [JENKINS-36808] Multi-branch pipeline favorited via classic UI has "item" returned as MultiBranchPipelineImpl rather than BranchImpl

          Vivek Pandey added a comment -

          cliffmeyers In this case, API is returning what user has favorited. This is little odd situation because classic UI lets user favorite multi-branch project itself. This is ugly, in this case I would like to change our implementation of favoriting MBP where we are selecting default branch there. Instead when you query for favorite item, that time we will apply ugly hack to select 'default' branch and return it.

          Vivek Pandey added a comment - cliffmeyers In this case, API is returning what user has favorited. This is little odd situation because classic UI lets user favorite multi-branch project itself. This is ugly, in this case I would like to change our implementation of favoriting MBP where we are selecting default branch there. Instead when you query for favorite item, that time we will apply ugly hack to select 'default' branch and return it.

          Vivek Pandey added a comment -

          Vivek Pandey added a comment - cliffmeyers PR submitted: https://github.com/jenkinsci/blueocean-plugin/pull/363

            vivek Vivek Pandey
            cliffmeyers Cliff Meyers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: