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

Job URLs do not work correctly with Folder plugin

    XMLWordPrintable

Details

    Description

      In case of multibranch pipelines which use Folders plugin and Folders plugin itself, job urls are not correctly reflect real action urls, so it is preferable to use absolute urls instead of short ones.

      There is a PR that allows for the action urls to be generated correctly by means of using job absolute urls instead of short ones.

      P.S. A few days ago JENKINS-31202 has been resolved, but in case of multibranch pipelines action urls (for created by means of Dashboard plugin are not generated correctly when using job's short urls).

      The PR mentioned above fixes action urls using absolute job url instead of short one.

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_collector/AnalysisCollectorAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_collector/WarningsPerProjectPortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_core/AbstractTablePortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_core/AnalysisAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/checkstyle/CheckStyleAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/checkstyle/CheckStylePortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/dashboard_view/AbstractDashboardViewPortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/findbugs/FindBugsAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/findbugs/FindBugsPortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/pmd/PmdAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/pmd/PmdWarningsPortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/tasks/TaskScannerAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/tasks/TasksColumn.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/tasks/TasksPortlet.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/warnings/WarningsAction.java
            src/main/java/org/jenkinsci/test/acceptance/plugins/warnings/WarningsPortlet.java
            src/main/java/org/jenkinsci/test/acceptance/po/AbstractListViewColumn.java
            src/main/java/org/jenkinsci/test/acceptance/po/Build.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/PmdPluginTest.java
            src/test/java/plugins/WarningsPluginTest.java
            http://jenkins-ci.org/commit/acceptance-test-harness/a94aef1e8d8d340bd7bd01ba67ba7716fbea8b36
            Log:
            Pulled column and portlet tests up to AbstractAnalysisTest.

            Now all static analysis plug-ins have a common test that checks that the number of warnings is shown as a link in the warnings column and warnings table portlet.
            Currently a test does not check the URL itself it rather clicks the link to see if the navigation works. This could be used as a basis for JENKINS-39947.

            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_collector/AnalysisCollectorAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_collector/WarningsPerProjectPortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_core/AbstractTablePortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/analysis_core/AnalysisAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/checkstyle/CheckStyleAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/checkstyle/CheckStylePortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/dashboard_view/AbstractDashboardViewPortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/findbugs/FindBugsAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/findbugs/FindBugsPortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/pmd/PmdAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/pmd/PmdWarningsPortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/tasks/TaskScannerAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/tasks/TasksColumn.java src/main/java/org/jenkinsci/test/acceptance/plugins/tasks/TasksPortlet.java src/main/java/org/jenkinsci/test/acceptance/plugins/warnings/WarningsAction.java src/main/java/org/jenkinsci/test/acceptance/plugins/warnings/WarningsPortlet.java src/main/java/org/jenkinsci/test/acceptance/po/AbstractListViewColumn.java src/main/java/org/jenkinsci/test/acceptance/po/Build.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/PmdPluginTest.java src/test/java/plugins/WarningsPluginTest.java http://jenkins-ci.org/commit/acceptance-test-harness/a94aef1e8d8d340bd7bd01ba67ba7716fbea8b36 Log: Pulled column and portlet tests up to AbstractAnalysisTest. Now all static analysis plug-ins have a common test that checks that the number of warnings is shown as a link in the warnings column and warnings table portlet. Currently a test does not check the URL itself it rather clicks the link to see if the navigation works. This could be used as a basis for JENKINS-39947 .

            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_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
            drulli Ulli Hafner added a comment - - edited

            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?

            drulli Ulli Hafner added a comment - - edited 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?
            szhem 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.

            szhem 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.

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            src/main/java/hudson/plugins/analysis/dashboard/AbstractWarningsTablePortlet.java
            http://jenkins-ci.org/commit/analysis-core-plugin/2b20fe9e8ba17acff2a76ef5b5c3914d51dcf9b8
            Log:
            [FIXED JENKINS-39947] 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 added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/analysis/dashboard/AbstractWarningsTablePortlet.java http://jenkins-ci.org/commit/analysis-core-plugin/2b20fe9e8ba17acff2a76ef5b5c3914d51dcf9b8 Log: [FIXED JENKINS-39947] 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.

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            src/test/java/plugins/AbstractAnalysisTest.java
            src/test/java/plugins/AnalysisCollectorPluginTest.java
            http://jenkins-ci.org/commit/acceptance-test-harness/e4b60850a1cd480c851c38266de74f235a42ed5f
            Log:
            JENKINS-39947 Added verification of all portlet links.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/test/java/plugins/AbstractAnalysisTest.java src/test/java/plugins/AnalysisCollectorPluginTest.java http://jenkins-ci.org/commit/acceptance-test-harness/e4b60850a1cd480c851c38266de74f235a42ed5f Log: JENKINS-39947 Added verification of all portlet links.

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            src/test/java/plugins/AnalysisCollectorPluginTest.java
            http://jenkins-ci.org/commit/acceptance-test-harness/e1494cbc54b5ed731bfff007a59d7569fc695de4
            Log:
            JENKINS-39947 Fixed test case that now has correct link references.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/test/java/plugins/AnalysisCollectorPluginTest.java http://jenkins-ci.org/commit/acceptance-test-harness/e1494cbc54b5ed731bfff007a59d7569fc695de4 Log: JENKINS-39947 Fixed test case that now has correct link references.

            Code changed in jenkins
            User: Ulli Hafner
            Path:
            analysis-core
            http://jenkins-ci.org/commit/analysis-suite-plugin/5c0d2f628c29d8d000cbc9fdebe3ee79f249da56
            Log:
            [FIXED JENKINS-39947] 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 added a comment - Code changed in jenkins User: Ulli Hafner Path: analysis-core http://jenkins-ci.org/commit/analysis-suite-plugin/5c0d2f628c29d8d000cbc9fdebe3ee79f249da56 Log: [FIXED JENKINS-39947] 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.

            People

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

              Dates

                Created:
                Updated:
                Resolved: