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

Incorrect URLs for job actions if job is within a Folder

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            szhem Sergey Zhemzhitsky created issue -
            szhem Sergey Zhemzhitsky made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-39947 [ JENKINS-39947 ]
            Hide
            drulli 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).

            Show
            drulli 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).
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            drulli Ulli Hafner added a comment -

            Sergey Zhemzhitsky: 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?

            Show
            drulli Ulli Hafner added a comment - Sergey Zhemzhitsky : 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?
            szhem Sergey Zhemzhitsky made changes -
            Hide
            szhem Sergey Zhemzhitsky added a comment - - edited

            Ulli Hafner: 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.

            Show
            szhem Sergey Zhemzhitsky added a comment - - edited Ulli Hafner : 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.
            drulli Ulli Hafner made changes -
            Component/s cloudbees-folder-plugin [ 18137 ]
            Component/s dashboard-view-plugin [ 15679 ]
            Component/s multi-branch-project-plugin (not Pipeline) [ 21127 ]
            Component/s nested-view-plugin [ 15701 ]
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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.
            drulli 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). ]
            Hide
            drulli Ulli Hafner added a comment -

            Thanks for the detailed description, I can now reproduce the problem...

            Show
            drulli Ulli Hafner added a comment - Thanks for the detailed description, I can now reproduce the problem...
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            analysis-collector.iml
            src/main/java/hudson/plugins/analysis/collector/WarningsAggregator.java
            src/main/java/hudson/plugins/analysis/collector/dashboard/WarningsTablePortlet.java
            http://jenkins-ci.org/commit/analysis-collector-plugin/79da226ab5a3561d37410520d821f53404e5185a
            Log:
            [FIXED JENKINS-39950] Use getUrl rather than getShortUrl.

            getShortUrl does not work with jobs in folders, we rather need to use
            getUrl. Since getUrl also has the container url as prefix, this part
            needs to be stripped of.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: analysis-collector.iml src/main/java/hudson/plugins/analysis/collector/WarningsAggregator.java src/main/java/hudson/plugins/analysis/collector/dashboard/WarningsTablePortlet.java http://jenkins-ci.org/commit/analysis-collector-plugin/79da226ab5a3561d37410520d821f53404e5185a Log: [FIXED JENKINS-39950] Use getUrl rather than getShortUrl. getShortUrl does not work with jobs in folders, we rather need to use getUrl. Since getUrl also has the container url as prefix, this part needs to be stripped of.
            scm_issue_link SCM/JIRA link daemon made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            src/main/java/org/jenkinsci/test/acceptance/po/ViewsMixIn.java
            src/test/java/plugins/AnalysisCollectorPluginTest.java
            http://jenkins-ci.org/commit/acceptance-test-harness/512817eef59b08b07c23e974f4853ec9a275b158
            Log:
            JENKINS-39950 Added verification of all portlet links.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/org/jenkinsci/test/acceptance/po/ViewsMixIn.java src/test/java/plugins/AnalysisCollectorPluginTest.java http://jenkins-ci.org/commit/acceptance-test-harness/512817eef59b08b07c23e974f4853ec9a275b158 Log: JENKINS-39950 Added verification of all portlet links.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: