Skip to content

Introduce RemoveSomethingStepTest - #362

Merged
strangelookingnerd merged 1 commit into
jenkinsci:masterfrom
jimklimov:remove-step
Jun 10, 2026
Merged

Introduce RemoveSomethingStepTest#362
strangelookingnerd merged 1 commit into
jenkinsci:masterfrom
jimklimov:remove-step

Conversation

@jimklimov

@jimklimov jimklimov commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Cheers, I am troubleshooting the mysterious case of a disappearing summary in my pipeline library (a placeholder entry is added, seen on the build page, but later disappears instead of being updated - maybe due to a removeBadges() with no id constraint between job phases).

To confirm or rule this out, the proposed test was added (passes both ways on my local build at least, so probably my library problem lurks elsewhere), and now I hope the tested cases make sense in the upstream as a measure against future regression in this area.

I think they are more specific for this question than the existing RemoveBadgesStepTest and its descendant RemoveSummariesStepTest - which together form a smart construct, I concede, but did not leave me convinced that they test not only that the steps do the work requested, but also do not have unrequested side impacts. Maybe they do, lost somewhere in the web of assertActionExists(run, expected); checks, while my code spells out the calls and expectations unambiguously :-D

@jimklimov
jimklimov requested a review from a team as a code owner June 10, 2026 13:39
Signed-off-by: Jim Klimov <jimklimov+jenkinsci@gmail.com>

@daniel-kraemer daniel-kraemer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections against adding more tests and coverage.
If you can share a reproducer for the initial issue you are having, I could help pin down the root cause?

@strangelookingnerd
strangelookingnerd merged commit c79ed4b into jenkinsci:master Jun 10, 2026
20 checks passed
@strangelookingnerd

Copy link
Copy Markdown
Contributor

Wrong account…anyways, the offering still stands 😅

@jimklimov
jimklimov deleted the remove-step branch June 11, 2026 07:05
@jimklimov

jimklimov commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I think the root cause was that part of our library still referred to manager.* methods (Groovy PostBuild Plugin) trying to adapt to Jenkins controllers that run different generations and variants of plugins that deal with badges (library is well-aged and did accumulate some baggage).

And there I see that removeBadges() deals with AbstractBadgeAction.class and not specifically a BadgeAction.class: https://github.com/jenkinsci/groovy-postbuild-plugin/blob/22e789fa762ed587f1e162e86491e3f05c510b78/src/main/java/org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildRecorder.java#L213-L219

For comparison, removeSummaries() nearby does deal with the specific BadgeSummaryAction.class.

The weird thing for me is that the saved references to these badges do remain valid, strings can be changed etc. - just that with their Action detached from the Build, they no longer visualize there.

jimklimov added a commit to jimklimov/groovy-postbuild-plugin that referenced this pull request Jun 13, 2026
As discovered during investigation that led to jenkinsci/badge-plugin#362 this plugin's `removeBadges()` action actually removes both badges and summaries (is not limited to specifically `BadgeAction`).

There are a couple of ways out of this:
* Define a new method name for the new activity = least surprise for existing consumers that might rely on this (mis-)behavior.
* Accept that this was a bug and redefine `removeBadges()`  to remove only badges = least surprise for consumers of the current Badge API plugin, and more intuitively matching the name.
  * If anyone wanted a way to remove any derivative of `AbstractBadgeAction` in one go, a separate method specifically for that can be used, again more intuitively fitting. This would be effectively about swapping the names and updating javadocs of methods impacted by this PR's initial commit.

For now, I went with the first option, but consider the second one superior (albeit a slightly breaking change, potentially). Up to maintainers :)
@jimklimov

Copy link
Copy Markdown
Contributor Author

Fired an educated guess for GPB Plugin at jenkinsci/groovy-postbuild-plugin#197

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants