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

ProjectActions (and trend graphs) do not appear for failed projects

    Details

    • Similar Issues:

      Description

      Since junit-1.2, neither the "Latest Test Result" information nor the "Test Result Trend" plot appear on the project page _if there is not at least one build in non-failed state.

      See screenshots below for an example: after deleting unstable build #11, the abovementioned items disappear.

      The problem did not exist when the plugin was still included in Jenkins (1.576), nor does it exist in versions 1.0 and 1.1 of the plugin. I suspect that this behaviour was introduced with commit 4ba5a49 ("JENKINS-23713 Compatibility with SimpleBuildStep."), but unfortunately I cannot find the exact root cause within that commit.

      This problem is not only related to the JUnit plug-in. In general, every plug-in that has been migrated its actions to a SimpleBuildStep has this problem. The affected source code is in SimpleBuildStep.

      A test case that exposes this bug is WarningsPluginTest#should_not_skip_failed_builds_with_option_run_always

      See also the corresponding mailing list discussion.

        Attachments

        1. patch.txt
          3 kB
        2. withOutTrend.png
          withOutTrend.png
          60 kB
        3. withTrend.png
          withTrend.png
          81 kB

          Issue Links

            Activity

            Hide
            arost Alexander Ost added a comment -

            Daniel, we're using a freestyle job to run tests in a custom unit test environment. If _any _of the tests fails, then the run will be marked as FAILED.

            The junit-plugin is used to display the test results and to provide convenient access to logs etc. Some of this information (trend plot, link to latest test result) are showing up only when there has ever been at least one PASSED or UNSTABLE run – and that's why I created this issue.

            Show
            arost Alexander Ost added a comment - Daniel, we're using a freestyle job to run tests in a custom unit test environment. If _any _of the tests fails, then the run will be marked as FAILED. The junit-plugin is used to display the test results and to provide convenient access to logs etc. Some of this information (trend plot, link to latest test result) are showing up only when there has ever been at least one PASSED or UNSTABLE run – and that's why I created this issue.
            Hide
            yafim_kazak Yafim Kazak added a comment -

            I agree with Alex. We run load tests and other test which are customers would like to fail build if failed but still see the results.
            I believe that it should be changed as in the TODO to Successful build.
            It's a wrong paradigm to get last successful job to check for actions - than to scan the job for builds with actions.
            Users would like to see what failed it - especially when we talk in the world of Jenkins as an automation server - it should provide the test results even if it failed due to bad score in tests or etc. The only other option is unstable which doesn't serve properly the meaning of successfully run but failed a critical test.

            Show
            yafim_kazak Yafim Kazak added a comment - I agree with Alex. We run load tests and other test which are customers would like to fail build if failed but still see the results. I believe that it should be changed as in the TODO to Successful build. It's a wrong paradigm to get last successful job to check for actions - than to scan the job for builds with actions. Users would like to see what failed it - especially when we talk in the world of Jenkins as an automation server - it should provide the test results even if it failed due to bad score in tests or etc. The only other option is unstable which doesn't serve properly the meaning of successfully run but failed a critical test.
            Hide
            drulli Ulli Hafner added a comment -

            I changed the title since the problem is not related to JUnit plug-in only. Every plug-in that shows project actions has this problem, so I think we should have a fix in core. I do not see why we can't replace j.getLastSuccessfulBuild with j.getLastBuild in LastBuildActionFactory.

            Show
            drulli Ulli Hafner added a comment - I changed the title since the problem is not related to JUnit plug-in only. Every plug-in that shows project actions has this problem, so I think we should have a fix in core. I do not see why we can't replace j.getLastSuccessfulBuild with j.getLastBuild in LastBuildActionFactory.
            Hide
            jglick Jesse Glick added a comment -

            Explained on jenkinsci-dev why that will not work. My suggestion was to amend the logic to check both getLastSuccessfulBuild and getLastCompletedBuild in case both exist but the latter is newer; collect all the LastBuildAction from each; for each LastBuildAction class, pick the newest of the two choices, if both exist; then call getProjectActions on those.

            Show
            jglick Jesse Glick added a comment - Explained on jenkinsci-dev why that will not work. My suggestion was to amend the logic to check both getLastSuccessfulBuild and getLastCompletedBuild in case both exist but the latter is newer; collect all the LastBuildAction from each; for each LastBuildAction class, pick the newest of the two choices, if both exist; then call getProjectActions on those.
            Hide
            drulli Ulli Hafner added a comment -

            That sounds like a reasonable workaround.

            Here is a test case to reproduce the bug (just remove the Ignore tag): should_not_skip_failed_builds_with_option_run_always.

            Show
            drulli Ulli Hafner added a comment - That sounds like a reasonable workaround. Here is a test case to reproduce the bug (just remove the Ignore tag): should_not_skip_failed_builds_with_option_run_always .

              People

              • Assignee:
                Unassigned
                Reporter:
                arost Alexander Ost
              • Votes:
                7 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

                • Created:
                  Updated: