-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: htmlpublisher-plugin
-
None
-
Environment:- Jenkins version: 2.479+
- HTML Publisher Plugin version: 1.32+
- Affects: Pipeline jobs (WorkflowJob) only
- Does not affect: Freestyle jobs (different action factory)
-
- 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<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:
- 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)