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

Links to branch jobs on custom views in multibranch projects are broken

      Users are able to create custom views for multibranch projects, however if that view is not the primary view, all links to the branch projects are broken. This is because the URL child prefix for multibranch projects is branch (https://github.com/jenkinsci/branch-api-plugin/blob/branch-api-1.0/src/main/java/jenkins/branch/MultiBranchProject.java#L463).

      Views do not have a Stapler URL binding getBranch(String name), but the fallback for the primary view onto the MultiBranchProject class masks this issue.

      Reproduce:

      1. Create multibranch project (any type)
      2. Index some branches
      3. Create a new view with some branches in it
      4. Do not make it the primary view
      5. Click a link to a branch on the new view
      6. Observe broken link root/job/my-multibranch/view/custom-view/branch/branch-name
      7. Make the new view the primary view
      8. Click a link to a branch on the new view
      9. Observe branch project page

          [JENKINS-32178] Links to branch jobs on custom views in multibranch projects are broken

          Code changed in jenkins
          User: Matthew DeTullio
          Path:
          src/main/java/jenkins/branch/MultiBranchProject.java
          http://jenkins-ci.org/commit/branch-api-plugin/02e6a0010d94d2b8d913ef9a43de961c81bb061e
          Log:
          JENKINS-32178 Remove URL child prefix override.

          By removing the prefix override, links to the sub-projects
          on custom views will use the default "job", allowing the
          views' existing Stapler URL bindings to correctly load the
          page for the item.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Matthew DeTullio Path: src/main/java/jenkins/branch/MultiBranchProject.java http://jenkins-ci.org/commit/branch-api-plugin/02e6a0010d94d2b8d913ef9a43de961c81bb061e Log: JENKINS-32178 Remove URL child prefix override. By removing the prefix override, links to the sub-projects on custom views will use the default "job", allowing the views' existing Stapler URL bindings to correctly load the page for the item.

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/branch/MultiBranchProject.java
          http://jenkins-ci.org/commit/branch-api-plugin/c478564fbfb728359010f17be310153b5fe18404
          Log:
          Merge pull request #35 from mjdetullio/JENKINS-32178

          JENKINS-32178 Fix broken links to branches from custom views

          Compare: https://github.com/jenkinsci/branch-api-plugin/compare/394c563e4c82...c478564fbfb7

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/branch/MultiBranchProject.java http://jenkins-ci.org/commit/branch-api-plugin/c478564fbfb728359010f17be310153b5fe18404 Log: Merge pull request #35 from mjdetullio/ JENKINS-32178 JENKINS-32178 Fix broken links to branches from custom views Compare: https://github.com/jenkinsci/branch-api-plugin/compare/394c563e4c82...c478564fbfb7

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java
          http://jenkins-ci.org/commit/cloudbees-folder-plugin/70c69809e7e91a05fa0305388db1c1f3c88bf426
          Log:
          JENKINS-32178 Noting why you should not override getUrlChildPrefix, at least until views honor this method.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/70c69809e7e91a05fa0305388db1c1f3c88bf426 Log: JENKINS-32178 Noting why you should not override getUrlChildPrefix, at least until views honor this method.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java
          http://jenkins-ci.org/commit/cloudbees-folder-plugin/214079bb3b66614c2b4de37b2a2df070ffdad0a0
          Log:
          Merge pull request #65 from jglick/JENKINS-32178-Javadoc

          JENKINS-32178 Noting why you should not override getUrlChildPrefix

          Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/9987689fe62a...214079bb3b66

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java http://jenkins-ci.org/commit/cloudbees-folder-plugin/214079bb3b66614c2b4de37b2a2df070ffdad0a0 Log: Merge pull request #65 from jglick/ JENKINS-32178 -Javadoc JENKINS-32178 Noting why you should not override getUrlChildPrefix Compare: https://github.com/jenkinsci/cloudbees-folder-plugin/compare/9987689fe62a...214079bb3b66

          Giorgio Sironi added a comment - - edited

          I was experiencing this bug and I just had to upgrade to fix it. Thanks!

          Giorgio Sironi added a comment - - edited I was experiencing this bug and I just had to upgrade to fix it. Thanks!

            mjdetullio Matthew DeTullio
            mjdetullio Matthew DeTullio
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: