Skip to content

[JENKINS-76148] Report Tab is missing from the Job/Project page when keepAll:false while running pipeline Job (not Freestyle) #579

@jenkins-infra-bot

Description

@jenkins-infra-bot
    1. HTML Publisher Plugin: Report tabs disappear when keepAll=false and Pipeline builds fail*
       
      1. Problem Description*
         
        When using the HTML Publisher plugin with Pipeline jobs (WorkflowJob), report tabs disappear from the project page under the following specific conditions:
         
        -`keepAll` is set to `false`
  • The most recent build has failed (FAILURE, UNSTABLE, etc.)
  • There is no successful build available
     
      1. Expected Behavior*
         
        Report tabs should be visible on the project page regardless of build status when HTML reports have been published, matching the behavior when `keepAll=true`.
         
      2. Actual Behavior*
         
        Report tabs are **not visible** on the project page when `keepAll=false` and the latest build has failed, even though the HTML reports were successfully published during that failed build.
         
      3. Root Cause Analysis*
         
        The issue is in `WorkflowActionsFactory.java` which is responsible for creating project-level actions (tabs) for Pipeline jobs. The original implementation had a critical flaw:
         
        **Original problematic code:**
        ```java
        final Run r = j.getLastSuccessfulBuild();
        if (r != null) {
        // Process both HTMLBuildAction and HTMLPublishedForProjectMarkerAction from same build
        List reports = r.getActions(HtmlPublisherTarget.HTMLBuildAction.class);
        // ... process reports
        List projectLevelReports =
        r.getActions(HtmlPublisherTarget.HTMLPublishedForProjectMarkerAction.class);
        // ... process project reports
        }
        ```
         
        **The problem:** The factory only checked `getLastSuccessfulBuild()` and completely ignored `getLastBuild()`. When builds fail:
  • `getLastSuccessfulBuild()` returns `null` (no successful builds available)
  • The entire action creation logic is skipped
  • No project tabs are created, even though failed builds may contain `HTMLPublishedForProjectMarkerAction` (for `keepAll=false` reports)
     
      1. Impact*
         
        This affects Pipeline jobs using HTML Publisher with:
  • `keepAll=false` configuration
  • Builds that fail but still generate HTML reports
  • Projects where the most recent successful build is older or non-existent
     
    The reports are still accessible via direct URLs but the UI tabs disappear, creating poor user experience.
     
      1. Reproduction Steps*
         
        1. Create a Pipeline job with HTML Publisher step using `keepAll: false`
        2. Configure the pipeline to publish HTML reports but then fail (e.g., with `error()` step)
        3. Run the job until it fails
        4. Observe that report tabs are missing from the project page
        5. Verify reports are still accessible via direct URLs
         
      2. Environment*
         
  • Jenkins version: 2.479+
  • HTML Publisher Plugin version: 1.32+
  • Affects: Pipeline jobs (WorkflowJob) only
  • Does not affect: Freestyle jobs (different action factory)
     
      1. Related Code*
         
  • {}Primary fix{}: `src/main/java/htmlpublisher/workflow/WorkflowActionsFactory.java`
  • {}Supporting fix{}: `src/main/java/htmlpublisher/HtmlPublisherTarget.java` (UI action methods)
     
      1. Test Coverage*
         
        Comprehensive test suite added in `WorkflowActionsFactoryTest.java` covering:
  • Failed builds with `keepAll=false` (core issue)
  • Successful builds with `keepAll=true` (regression prevention)
  • Mixed scenarios with both successful and failed builds
  • Edge cases (no builds, null builds, non-workflow jobs)

Originally reported by aviral282, imported from: Report Tab is missing from the Job/Project page when keepAll:false while running pipeline Job (not Freestyle)
  • assignee: aviral282
  • status: In Review
  • priority: Minor
  • component(s): htmlpublisher-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 20251211-193728
Raw content of original issue
    1. HTML Publisher Plugin: Report tabs disappear when keepAll=false and Pipeline builds fail*  
      1. Problem Description*   When using the HTML Publisher plugin with Pipeline jobs (WorkflowJob), report tabs disappear from the project page under the following specific conditions:   -`keepAll` is set to `false`
  • The most recent build has failed (FAILURE, UNSTABLE, etc.)
  • There is no successful build available  
      1. Expected Behavior*   Report tabs should be visible on the project page regardless of build status when HTML reports have been published, matching the behavior when `keepAll=true`.  
      2. Actual Behavior*   Report tabs are **not visible** on the project page when `keepAll=false` and the latest build has failed, even though the HTML reports were successfully published during that failed build.  
      3. Root Cause Analysis*   The issue is in `WorkflowActionsFactory.java` which is responsible for creating project-level actions (tabs) for Pipeline jobs. The original implementation had a critical flaw:   **Original problematic code:** ```java final Run<?,?> r = j.getLastSuccessfulBuild(); if (r != null) { // Process both HTMLBuildAction and HTMLPublishedForProjectMarkerAction from same build List<HtmlPublisherTarget.HTMLBuildAction> reports = r.getActions(HtmlPublisherTarget.HTMLBuildAction.class); // ... process reports List<HtmlPublisherTarget.HTMLPublishedForProjectMarkerAction> projectLevelReports = r.getActions(HtmlPublisherTarget.HTMLPublishedForProjectMarkerAction.class); // ... process project reports } ```   **The problem:** The factory only checked `getLastSuccessfulBuild()` and completely ignored `getLastBuild()`. When builds fail:
  • `getLastSuccessfulBuild()` returns `null` (no successful builds available)
  • The entire action creation logic is skipped
  • No project tabs are created, even though failed builds may contain `HTMLPublishedForProjectMarkerAction` (for `keepAll=false` reports)  
      1. Impact*   This affects Pipeline jobs using HTML Publisher with:
  • `keepAll=false` configuration
  • Builds that fail but still generate HTML reports
  • Projects where the most recent successful build is older or non-existent   The reports are still accessible via direct URLs but the UI tabs disappear, creating poor user experience.  
      1. Reproduction Steps*   1. Create a Pipeline job with HTML Publisher step using `keepAll: false` 2. Configure the pipeline to publish HTML reports but then fail (e.g., with `error()` step) 3. Run the job until it fails 4. Observe that report tabs are missing from the project page 5. Verify reports are still accessible via direct URLs  
      2. Environment*  
  • Jenkins version: 2.479+
  • HTML Publisher Plugin version: 1.32+
  • Affects: Pipeline jobs (WorkflowJob) only
  • Does not affect: Freestyle jobs (different action factory)  
      1. Related Code*  
  • {}Primary fix{}: `src/main/java/htmlpublisher/workflow/WorkflowActionsFactory.java`
  • {}Supporting fix{}: `src/main/java/htmlpublisher/HtmlPublisherTarget.java` (UI action methods)  
      1. Test Coverage*   Comprehensive test suite added in `WorkflowActionsFactoryTest.java` covering:
  • Failed builds with `keepAll=false` (core issue)
  • Successful builds with `keepAll=true` (regression prevention)
  • Mixed scenarios with both successful and failed builds
  • Edge cases (no builds, null builds, non-workflow jobs)
environment
- Jenkins version: 2.479+<br/>
- HTML Publisher Plugin version: 1.32+<br/>
- Affects: Pipeline jobs (WorkflowJob) only<br/>
- Does not affect: Freestyle jobs (different action factory)

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions