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

Cannot mark Multibranch Pipeline as Favorite in Blue Ocean when no master branch

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Duplicate
    • blueocean-plugin
    • jenkins-2.7.4
      blueocean - Built at 27th September 2016 03:05 AM (no branch) 57f7758
      Safari Version 9.1.3 (& FireFox 49.0.1)

    Description

      Summary: if there is no master branch, if you try to favourite a MB pipeline (vs a specific branch) it does incorrect things. It should work out what the default branch is (or ask user) or at least tell them to pick a branch... (latter is easiest).

      If a user has favourited a MB pipeline folder in classic, blue ocean should ignore that.


      Steps:

      1. Click "New Item" and Create "Multibranch Pipeline" without branch "master".
      2. Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
      3. Open Jenkins Blue Ocean.
        Actual Result: New line for this job has been created in "Favorites" (grey colour). "Run" button hasn't worked.
      4. Open Dashboard Jenkins -> this Multibranch Pipeline. Check "Favorite" button for any branch.
        E.R. = A.R.: No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
      5. Disable "Favorite" for this job.
      6. Open Jenkins Blue Ocean.
      7. Click "Favorite" button for Multibranch Pipeline.
        Expected Result: Favorite label has been added. New line for this job has been created in "Favorites".
        Actual Result: Failed to load resource: the server responded with a status of 400 (Bad Request)
        {
            "message" : "no master branch to favorite",
            "code" : 400,
            "errors" : [ ]
        }
        
      8. Disable "Favorite" for this job.
        Expected Result: Favorite label has been deleted.
        Actual Result: TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')

      Attachments

        Issue Links

          Activity

            ks_nenasheva Kseniia Nenasheva created issue -
            ks_nenasheva Kseniia Nenasheva made changes -
            Field Original Value New Value
            Attachment PipelineMB_favorite.gif [ 34131 ]
            ks_nenasheva Kseniia Nenasheva made changes -
            Summary Can't put a label "Favorites" for Multibranch Pipeline in Jenkins Blue Ocean Cannot mark Multibranch Pipeline as Favorite in Blue Ocean

            I did some minor investigation on this one.
            The implementation looks explicitly for the job named master in the Multibranch project, and that is the job marked as favorite, by default. Therefore, you'll need to have a job called master for this to work.
            For example, you can point your Multibranch project to this repository: https://github.com/jenkinsci/git-plugin, and the branch indexing will automatically create the master job, and then the favorite feature should work.

            alexsomai Alexandru Somai added a comment - I did some minor investigation on this one. The implementation looks explicitly for the job named master in the Multibranch project, and that is the job marked as favorite, by default. Therefore, you'll need to have a job called master for this to work. For example, you can point your Multibranch project to this repository: https://github.com/jenkinsci/git-plugin , and the branch indexing will automatically create the master job, and then the favorite feature should work.
            jamesdumay James Dumay added a comment -

            Eventually we want the default branch name to be whatever the upstreams "default branch" is (both Github and Bitbucket share a default branch concept).

            I didn't understand what your expected behavior should be in this case - did you mean we should disable the favoriting button if the master branch does not exist?

            jamesdumay James Dumay added a comment - Eventually we want the default branch name to be whatever the upstreams "default branch" is (both Github and Bitbucket share a default branch concept). I didn't understand what your expected behavior should be in this case - did you mean we should disable the favoriting button if the master branch does not exist?
            jamesdumay James Dumay added a comment -

            I think at the very least we can make this fail without an error in the console and pop up a toast to say that we couldn't favorite the pipeline as master branch does not exist?

            jamesdumay James Dumay added a comment - I think at the very least we can make this fail without an error in the console and pop up a toast to say that we couldn't favorite the pipeline as master branch does not exist?
            ks_nenasheva Kseniia Nenasheva made changes -
            Description +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            ks_nenasheva Kseniia Nenasheva made changes -
            Description +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            # Open Jenkins Blue Ocean.
            *Actual Result:* New line for this job has been created in "Favorites" (grey colour). "Run" button hasn't worked.
            # Open Dashboard Jenkins -> this Multibranch Pipeline. Check "Favorite" button for any branch.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')

            Updated the reproduction steps.

            Repositories without master branch are not so uncommon, hence this issues is pretty important. GitHub also allows specifying different branch as a main one. Blue Ocean should not hardcode the branch IMHO.

            Error output to the console (console only) - is a bad idea. I can offer two options:
            1 - In the absence of branches "master" appoint another main branch (default / on the last commit, etc.)
            2 - Show a message stating that the branch "master" is not found, and offer the user to choose your favorite branch in Jenkins Dashboard (branch, not MB project). If user selected the project, then the project in the Blue Ocean will be displayed in the favorites, with empty branches, and "run" button will not be worked (please see steps 2-4).

            ks_nenasheva Kseniia Nenasheva added a comment - Updated the reproduction steps. Repositories without master branch are not so uncommon, hence this issues is pretty important. GitHub also allows specifying different branch as a main one. Blue Ocean should not hardcode the branch IMHO. Error output to the console (console only) - is a bad idea. I can offer two options: 1 - In the absence of branches "master" appoint another main branch (default / on the last commit, etc.) 2 - Show a message stating that the branch "master" is not found, and offer the user to choose your favorite branch in Jenkins Dashboard (branch, not MB project). If user selected the project, then the project in the Blue Ocean will be displayed in the favorites, with empty branches, and "run" button will not be worked (please see steps 2-4).
            michaelneale Michael Neale added a comment -

            Thanks ks_nenasheva - well spotted.

            Currently if you favourite it from blue ocean it should search for a suitable branch (but it won't look for the default as setup in github/bitbucket, as that information isn't currently available yet). However, from your steps, it looks like favouriting it from Jenkins itself is a problem? (this may be a related bug, but not quite the same). Blue ocean can only show favourites for a branch (hence it tries to pick a default) - it can't show a favourite of what is effectively a folder.

            The logic should be (for blue ocean): Favourite a MB pipeline -> choose default branch as per SCM provider -> (if none available) look for master/production/default named branch -> (if none found) -> pick the first one alphabetically so there is at least one branch.

            What I am curious about is what is the behavior if people don't want a favourite on a branch (I need to investigate that a bit)

            michaelneale Michael Neale added a comment - Thanks ks_nenasheva - well spotted. Currently if you favourite it from blue ocean it should search for a suitable branch (but it won't look for the default as setup in github/bitbucket, as that information isn't currently available yet). However, from your steps, it looks like favouriting it from Jenkins itself is a problem? (this may be a related bug, but not quite the same). Blue ocean can only show favourites for a branch (hence it tries to pick a default) - it can't show a favourite of what is effectively a folder. The logic should be (for blue ocean): Favourite a MB pipeline -> choose default branch as per SCM provider -> (if none available) look for master/production/default named branch -> (if none found) -> pick the first one alphabetically so there is at least one branch. What I am curious about is what is the behavior if people don't want a favourite on a branch (I need to investigate that a bit)
            michaelneale Michael Neale added a comment -

            ok, I think I see what is happening.
            When you fav a branch in classic, it is just marking the Item (a folder) as favourite. Blue Ocean incorrectly shows this up IF you have a master branch. It ideally would not.

            It may be a while before the github/bitbuckets can report their default branches (which is clearly what should happen here in either case) so I think this is what should happen to remedy this:

            • When favouriting a pipeline (not a branch) from blue ocean, if there is no master branch, ask the user to navigate and pick a branch (or, disable the favouriting feature for now, only on the branch) with a polite message
            • If the user has favourited the multibranch folder in "classic", this should not show up as a fav. of the master branch in blue ocean (as it is now, if there is a master branch, you can end up with duplicate favourites) – this is what this bug is initially showing up.
            • If the favourite is for a branch that doesn't exist (is it possible to know this?) - don't show it up as a fav.
            michaelneale Michael Neale added a comment - ok, I think I see what is happening. When you fav a branch in classic, it is just marking the Item (a folder) as favourite. Blue Ocean incorrectly shows this up IF you have a master branch. It ideally would not. It may be a while before the github/bitbuckets can report their default branches (which is clearly what should happen here in either case) so I think this is what should happen to remedy this: When favouriting a pipeline (not a branch) from blue ocean, if there is no master branch, ask the user to navigate and pick a branch (or, disable the favouriting feature for now, only on the branch) with a polite message If the user has favourited the multibranch folder in "classic", this should not show up as a fav. of the master branch in blue ocean (as it is now, if there is a master branch, you can end up with duplicate favourites) – this is what this bug is initially showing up. If the favourite is for a branch that doesn't exist (is it possible to know this?) - don't show it up as a fav.
            michaelneale Michael Neale made changes -
            Assignee Cliff Meyers [ cliffmeyers ]
            michaelneale Michael Neale made changes -
            Epic Link JENKINS-35761 [ 171656 ]

            I'm having the same problem with multibranch pipelines, for example in a folder where the default branch is develop (and that's the only branch I have listed in "Include branches").

            In some other multibranch pipelines, I'm not building any branches at all — only pull requests. I can't favourite those folders either.

            orrc Christopher Orr added a comment - I'm having the same problem with multibranch pipelines, for example in a folder where the default branch is develop (and that's the only branch I have listed in "Include branches"). In some other multibranch pipelines, I'm not building any branches at all — only pull requests. I can't favourite those folders either.
            jamesdumay James Dumay made changes -
            Link This issue is blocked by JENKINS-39083 [ JENKINS-39083 ]
            jamesdumay James Dumay made changes -
            Link This issue is blocked by JENKINS-39082 [ JENKINS-39082 ]
            michaelneale Michael Neale made changes -
            Sprint indian [ 126 ]
            michaelneale Michael Neale made changes -
            Summary Cannot mark Multibranch Pipeline as Favorite in Blue Ocean Cannot mark Multibranch Pipeline as Favorite in Blue Ocean when no master branch
            michaelneale Michael Neale made changes -
            Description +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            # Open Jenkins Blue Ocean.
            *Actual Result:* New line for this job has been created in "Favorites" (grey colour). "Run" button hasn't worked.
            # Open Dashboard Jenkins -> this Multibranch Pipeline. Check "Favorite" button for any branch.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            Summary: if there is no master branch, if you try to favourite a MB pipeline (vs a specific branch) it does incorrect things. It should work out what the default branch is (or ask user) or at least tell them to pick a branch... (latter is easiest).

            +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            # Open Jenkins Blue Ocean.
            *Actual Result:* New line for this job has been created in "Favorites" (grey colour). "Run" button hasn't worked.
            # Open Dashboard Jenkins -> this Multibranch Pipeline. Check "Favorite" button for any branch.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            michaelneale Michael Neale added a comment -

            orrc oh interesting. That is a case I didn't think of - when you filter. Would it bug you if you went to fav a pipeline and it told you to pick a branch? As in your case, it won't know that "develop" if the default branch even if all the stars aligned and there was a default branch (as that isn't the default branch necessarily, its just how filtered).

            I think simplest thing we can do is for MB that don't have master branch - we ask user to pick which branch if they try (or remove the star icon). Blue ocean has no concept of fav'ing a folder (the fact that a MB pipeline is actually a folder is a leaky implementation detail), as fav's apply to branches that do work only.

            There may be other strategies...
            cliffmeyers we should talk about this some time.

            michaelneale Michael Neale added a comment - orrc oh interesting. That is a case I didn't think of - when you filter. Would it bug you if you went to fav a pipeline and it told you to pick a branch? As in your case, it won't know that "develop" if the default branch even if all the stars aligned and there was a default branch (as that isn't the default branch necessarily, its just how filtered). I think simplest thing we can do is for MB that don't have master branch - we ask user to pick which branch if they try (or remove the star icon). Blue ocean has no concept of fav'ing a folder (the fact that a MB pipeline is actually a folder is a leaky implementation detail), as fav's apply to branches that do work only. There may be other strategies... cliffmeyers we should talk about this some time.
            michaelneale Michael Neale added a comment -

            Perhaps a better solution is JENKINS-39087. If there is no master branch, you fav the MB folder and show no branch details (essentially just a shortcut, as requested)....

            michaelneale Michael Neale added a comment - Perhaps a better solution is JENKINS-39087 . If there is no master branch, you fav the MB folder and show no branch details (essentially just a shortcut, as requested)....
            michaelneale Michael Neale made changes -
            Link This issue relates to JENKINS-39087 [ JENKINS-39087 ]
            cliffmeyers Cliff Meyers added a comment -

            michaelneale vivek as there was some discussion about the current Favorite plugin having some bugs or other issues, I just thought I'd call one out:

            1. Favorite a branch in a multi-branch pipeline
            2. Favorite displays in dashboard as expected
            3. Go to classic UI. Move the MBP inside of a folder
            4. Reload BOUI: note that favorite is missing

            Not sure if this is applicable to all job types or just multi-branch.

            cliffmeyers Cliff Meyers added a comment - michaelneale vivek as there was some discussion about the current Favorite plugin having some bugs or other issues, I just thought I'd call one out: Favorite a branch in a multi-branch pipeline Favorite displays in dashboard as expected Go to classic UI. Move the MBP inside of a folder Reload BOUI: note that favorite is missing Not sure if this is applicable to all job types or just multi-branch.
            jamesdumay James Dumay made changes -
            Sprint indian [ 126 ] arctic [ 131 ]
            jamesdumay James Dumay made changes -
            Sprint arctic [ 131 ] arctic 2 [ 136 ]
            jamesdumay James Dumay made changes -
            Sprint arctic 2 [ 136 ] arctic [ 131 ]
            jamesdumay James Dumay made changes -
            Sprint arctic [ 131 ] arctic 2 [ 136 ]
            jamesdumay James Dumay made changes -
            Sprint tasman [ 136 ] tasman 2 [ 141 ]
            jamesdumay James Dumay made changes -
            Sprint tasman 2 [ 141 ]
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            michaelneale Michael Neale made changes -
            Description Summary: if there is no master branch, if you try to favourite a MB pipeline (vs a specific branch) it does incorrect things. It should work out what the default branch is (or ask user) or at least tell them to pick a branch... (latter is easiest).

            +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            # Open Jenkins Blue Ocean.
            *Actual Result:* New line for this job has been created in "Favorites" (grey colour). "Run" button hasn't worked.
            # Open Dashboard Jenkins -> this Multibranch Pipeline. Check "Favorite" button for any branch.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            Summary: if there is no master branch, if you try to favourite a MB pipeline (vs a specific branch) it does incorrect things. It should work out what the default branch is (or ask user) or at least tell them to pick a branch... (latter is easiest).

            If a user has favourited a MB pipeline *folder* in classic, blue ocean should ignore that.

            ----

            +Steps:+
            # Click "New Item" and Create "Multibranch Pipeline" without branch "master".
            # Open Dashboard Jenkins. Check "Favorite" button for Multibranch Pipeline.
            # Open Jenkins Blue Ocean.
            *Actual Result:* New line for this job has been created in "Favorites" (grey colour). "Run" button hasn't worked.
            # Open Dashboard Jenkins -> this Multibranch Pipeline. Check "Favorite" button for any branch.
            *E.R. = A.R.:* No error. Favorites Job have displayed correctly in Jenkins Blue Ocean.
            # Disable "Favorite" for this job.
            # Open Jenkins Blue Ocean.
            # Click "Favorite" button for Multibranch Pipeline.
            *Expected Result:* Favorite label has been added. New line for this job has been created in "Favorites".
            *Actual Result:* Failed to load resource: the server responded with a status of 400 (Bad Request)
            {noformat}
            {
                "message" : "no master branch to favorite",
                "code" : 400,
                "errors" : [ ]
            }
            {noformat}
            # Disable "Favorite" for this job.
            *Expected Result:* Favorite label has been deleted.
            *Actual Result:* TypeError: undefined is not an object (evaluating 'favoriteToRemove._links')
            jamesdumay James Dumay made changes -
            Rank Ranked higher
            jamesdumay James Dumay made changes -
            Rank Ranked lower
            jamesdumay James Dumay made changes -
            Assignee Cliff Meyers [ cliffmeyers ]
            jamesdumay James Dumay added a comment -

            This fix is in review as part of JENKINS-38718.

            jamesdumay James Dumay added a comment - This fix is in review as part of JENKINS-38718 .
            jamesdumay James Dumay made changes -
            Link This issue duplicates JENKINS-38718 [ JENKINS-38718 ]
            jamesdumay James Dumay made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            jbriden Jenn Briden made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

            People

              Unassigned Unassigned
              ks_nenasheva Kseniia Nenasheva
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: