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

Incorrect URLs for job actions if job is within a Folder

      For jobs contained withing folders action urls (urls to access warnings are generated) incorrectly leading to 404 http status codes.

      There is a pull request that fixes this issue by changing jobs' shortUrl to absoluteUrl to work correctly for jobs contained in folders.

          [JENKINS-39950] Incorrect URLs for job actions if job is within a Folder

          Sergey Zhemzhitsky created issue -
          Sergey Zhemzhitsky made changes -
          Link New: This issue is related to JENKINS-39947 [ JENKINS-39947 ]

          Ulli Hafner added a comment -

          We need to verify that this change does not break JENKINS-21723. (And that the ATH test cases in AbstractAnalysisTest#should_have_trend_graph_with_relative_links_in_freestyle_job will succeed).

          Ulli Hafner added a comment - We need to verify that this change does not break JENKINS-21723 . (And that the ATH test cases in AbstractAnalysisTest#should_have_trend_graph_with_relative_links_in_freestyle_job will succeed).

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_core/AnalysisAction.java
          src/main/java/org/jenkinsci/test/acceptance/po/Container.java
          src/main/java/org/jenkinsci/test/acceptance/po/Folder.java
          src/main/java/org/jenkinsci/test/acceptance/po/FolderItem.java
          src/main/java/org/jenkinsci/test/acceptance/po/Jenkins.java
          src/main/java/org/jenkinsci/test/acceptance/po/TopLevelItem.java
          src/main/java/org/jenkinsci/test/acceptance/po/WorkflowMultiBranchJob.java
          src/test/java/plugins/AbstractAnalysisTest.java
          src/test/java/plugins/AnalysisCollectorPluginTest.java
          src/test/java/plugins/CheckStylePluginTest.java
          src/test/java/plugins/FindBugsPluginTest.java
          src/test/java/plugins/FolderPluginTest.java
          src/test/java/plugins/PmdPluginTest.java
          src/test/java/plugins/TaskScannerPluginTest.java
          src/test/java/plugins/WarningsPluginTest.java
          http://jenkins-ci.org/commit/acceptance-test-harness/02c3799d89681b2447cffaa5380f45f803db9959
          Log:
          Added test case to expose JENKINS-39947 JENKINS-39950.

          The test case runs the static analysis plugins for a job that is part of a folder.

          Compare: https://github.com/jenkinsci/acceptance-test-harness/compare/87a407ef80af...02c3799d8968

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_core/AnalysisAction.java src/main/java/org/jenkinsci/test/acceptance/po/Container.java src/main/java/org/jenkinsci/test/acceptance/po/Folder.java src/main/java/org/jenkinsci/test/acceptance/po/FolderItem.java src/main/java/org/jenkinsci/test/acceptance/po/Jenkins.java src/main/java/org/jenkinsci/test/acceptance/po/TopLevelItem.java src/main/java/org/jenkinsci/test/acceptance/po/WorkflowMultiBranchJob.java src/test/java/plugins/AbstractAnalysisTest.java src/test/java/plugins/AnalysisCollectorPluginTest.java src/test/java/plugins/CheckStylePluginTest.java src/test/java/plugins/FindBugsPluginTest.java src/test/java/plugins/FolderPluginTest.java src/test/java/plugins/PmdPluginTest.java src/test/java/plugins/TaskScannerPluginTest.java src/test/java/plugins/WarningsPluginTest.java http://jenkins-ci.org/commit/acceptance-test-harness/02c3799d89681b2447cffaa5380f45f803db9959 Log: Added test case to expose JENKINS-39947 JENKINS-39950 . The test case runs the static analysis plugins for a job that is part of a folder. Compare: https://github.com/jenkinsci/acceptance-test-harness/compare/87a407ef80af...02c3799d8968

          Ulli Hafner added a comment -

          szhemzhitsky: Can you please have a look at the test case I have added to the ATH. Seems to work. Which link is exactly broken in this issue? Is something different in your setup?

          Ulli Hafner added a comment - szhemzhitsky : Can you please have a look at the test case I have added to the ATH. Seems to work. Which link is exactly broken in this issue? Is something different in your setup?
          Sergey Zhemzhitsky made changes -

          Sergey Zhemzhitsky added a comment - - edited

          drulli: I've attached the screenshots demonstrating what's going wrong (I'm using multi-branch pipeline, folders, nested view and dashboard view plugins)

          The hierarchy of the folders is the following

          authentication-service » build-multi » DMC-2273-continuous-delivery
          

          ... where

          • authentication-service - is the manually created folder (Folders plugin)
          • build-multi - is the name of the multi-branch pipeline job
          • DMC-2273-continuous-delivery - is the name of the automatically created job from the corresponding branch

          I've configured a nested view develop-main with the dashboard and this view has the following URL

          https://host:port/view/REPORTS/view/develop-main/
          

          Here is the screenshot that shows the original behavior of the analysis-collector-plugin's Dashboard.

          The URLs which lead us to the corresponding warnings page look like the following

          https://host:port/view/REPORTS/view/develop-main/job/DMC-2273-continuous-delivery/tasks
          

          ... where

          • REPORTS is the name of the view
          • develop-main is the name of the multi-branch pipeline job
          • DMC-2273-continuous-delivery is the name of the job that was created automatically

          Updated plugin with the applied pull request leads to generation of the following URLs

          https://host:port/view/REPORTS/view/develop-main/job/authentication-service/job/build-multi/job/DMC-2273-continuous-delivery/tasks
          

          So as you can see in case of unapplied and applied patch the URLs are different

          https://host:port/view/REPORTS/view/develop-main/job/DMC-2273-continuous-delivery/tasks
          // vs
          https://host:port/view/REPORTS/view/develop-main/job/authentication-service/job/build-multi/job/DMC-2273-continuous-delivery/tasks
          

          ... and we can see that in the first case all the intermediate folders (manually created one, and multi-branch pipeline's one) are missed.

          The missed folders lead us to 404 errors, and applying a patch makes the dashboard generate correct URLs.

          It also seems that according to the verifyPortlet and verifyColumn methods of the ATH only link text is verified, but not its href attribute.

          Sergey Zhemzhitsky added a comment - - edited drulli : I've attached the screenshots demonstrating what's going wrong (I'm using multi-branch pipeline, folders, nested view and dashboard view plugins) The hierarchy of the folders is the following authentication-service » build-multi » DMC-2273-continuous-delivery ... where authentication-service - is the manually created folder (Folders plugin) build-multi - is the name of the multi-branch pipeline job DMC-2273-continuous-delivery - is the name of the automatically created job from the corresponding branch I've configured a nested view develop-main with the dashboard and this view has the following URL https://host:port/view/REPORTS/view/develop-main/ Here is the screenshot that shows the original behavior of the analysis-collector-plugin's Dashboard. The URLs which lead us to the corresponding warnings page look like the following https://host:port/view/REPORTS/view/develop-main/job/DMC-2273-continuous-delivery/tasks ... where REPORTS is the name of the view develop-main is the name of the multi-branch pipeline job DMC-2273-continuous-delivery is the name of the job that was created automatically Updated plugin with the applied pull request leads to generation of the following URLs https://host:port/view/REPORTS/view/develop-main/job/authentication-service/job/build-multi/job/DMC-2273-continuous-delivery/tasks So as you can see in case of unapplied and applied patch the URLs are different https://host:port/view/REPORTS/view/develop-main/job/DMC-2273-continuous-delivery/tasks // vs https://host:port/view/REPORTS/view/develop-main/job/authentication-service/job/build-multi/job/DMC-2273-continuous-delivery/tasks ... and we can see that in the first case all the intermediate folders (manually created one, and multi-branch pipeline's one) are missed. The missed folders lead us to 404 errors, and applying a patch makes the dashboard generate correct URLs. It also seems that according to the verifyPortlet and verifyColumn methods of the ATH only link text is verified, but not its href attribute.
          Ulli Hafner made changes -
          Component/s New: cloudbees-folder-plugin [ 18137 ]
          Component/s New: dashboard-view-plugin [ 15679 ]
          Component/s New: multi-branch-project-plugin (not Pipeline) [ 21127 ]
          Component/s New: nested-view-plugin [ 15701 ]

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/org/jenkinsci/test/acceptance/plugins/dashboard_view/DashboardView.java
          src/main/java/org/jenkinsci/test/acceptance/plugins/git/GitRepo.java
          src/main/java/org/jenkinsci/test/acceptance/plugins/nested_view/NestedView.java
          src/main/java/org/jenkinsci/test/acceptance/plugins/workflow_multibranch/GitBranchSource.java
          src/main/java/org/jenkinsci/test/acceptance/po/View.java
          src/test/java/plugins/AnalysisCollectorPluginTest.java
          src/test/resources/analysis_collector_plugin/Jenkinsfile
          http://jenkins-ci.org/commit/acceptance-test-harness/63fa5aeaa3b59492ce4ea8f11ceab243e4a8afb8
          Log:
          JENKINS-39950 Reproduced broken links.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/org/jenkinsci/test/acceptance/plugins/dashboard_view/DashboardView.java src/main/java/org/jenkinsci/test/acceptance/plugins/git/GitRepo.java src/main/java/org/jenkinsci/test/acceptance/plugins/nested_view/NestedView.java src/main/java/org/jenkinsci/test/acceptance/plugins/workflow_multibranch/GitBranchSource.java src/main/java/org/jenkinsci/test/acceptance/po/View.java src/test/java/plugins/AnalysisCollectorPluginTest.java src/test/resources/analysis_collector_plugin/Jenkinsfile http://jenkins-ci.org/commit/acceptance-test-harness/63fa5aeaa3b59492ce4ea8f11ceab243e4a8afb8 Log: JENKINS-39950 Reproduced broken links.
          Ulli Hafner made changes -
          Comment [ Sorry that this takes so long on my side, I did not have much time recently. Thank you very much for the detailed explanation, I'm trying to improve the test case with your instructions (and additional plugins) now.

          What I still not understand is where you are creating the views? (what is the REPORTS view?) And which view is the nested view, and which is the dashboard?

          I tried to create a folder, and in the folder I can create a view Nested and in the Nested I can create a view Dashboard. This leads to Folder->Nested->Dashboard bread crumb. When I click on Dashboard I can add the portlet which shows the warnings of all jobs (note there are only basic job, not multi branch yet). Up to now, all links still are working. Maybe adding the next plugin will break the links (multi branch). ]

            drulli Ulli Hafner
            szhem Sergey Zhemzhitsky
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: