-
-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
-
- HTML Publisher Plugin: Report tabs disappear when keepAll=false and Pipeline builds fail*
- 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`
- Problem Description*
- HTML Publisher Plugin: Report tabs disappear when keepAll=false and Pipeline builds fail*
- The most recent build has failed (FAILURE, UNSTABLE, etc.)
- There is no successful build available
-
- 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`.
- 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.
- 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:
- Expected Behavior*
-
- `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)
-
- Impact*
This affects Pipeline jobs using HTML Publisher with:
- Impact*
-
- `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.
-
- 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
- Environment*
- Reproduction Steps*
-
- Jenkins version: 2.479+
- HTML Publisher Plugin version: 1.32+
- Affects: Pipeline jobs (WorkflowJob) only
- Does not affect: Freestyle jobs (different action factory)
-
- Related Code*
- Related Code*
-
- {}Primary fix{}: `src/main/java/htmlpublisher/workflow/WorkflowActionsFactory.java`
- {}Supporting fix{}: `src/main/java/htmlpublisher/HtmlPublisherTarget.java` (UI action methods)
-
- Test Coverage*
Comprehensive test suite added in `WorkflowActionsFactoryTest.java` covering:
- Test Coverage*
-
- 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
-
- HTML Publisher Plugin: Report tabs disappear when keepAll=false and Pipeline builds fail*
- 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`
- HTML Publisher Plugin: Report tabs disappear when keepAll=false and Pipeline builds fail*
- The most recent build has failed (FAILURE, UNSTABLE, etc.)
- There is no successful build available
-
- 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`.
- 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.
- 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)
-
- 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.
-
- 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
- Environment*
-
- Jenkins version: 2.479+
- HTML Publisher Plugin version: 1.32+
- Affects: Pipeline jobs (WorkflowJob) only
- Does not affect: Freestyle jobs (different action factory)
-
- Related Code*
-
- {}Primary fix{}: `src/main/java/htmlpublisher/workflow/WorkflowActionsFactory.java`
- {}Supporting fix{}: `src/main/java/htmlpublisher/HtmlPublisherTarget.java` (UI action methods)
-
- 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)
Reactions are currently unavailable