Skip to content

GroovyPostbuildRecorder.java: add a way to removeBadgesOnly() - #197

Open
jimklimov wants to merge 1 commit into
jenkinsci:masterfrom
jimklimov:patch-1
Open

GroovyPostbuildRecorder.java: add a way to removeBadgesOnly()#197
jimklimov wants to merge 1 commit into
jenkinsci:masterfrom
jimklimov:patch-1

Conversation

@jimklimov

@jimklimov jimklimov commented Jun 13, 2026

Copy link
Copy Markdown

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; maybe add a namesake to Badge plugin too for easiest co-existence. This would be effectively about swapping the names and updating javadocs of methods impacted by this PR's initial commit.
    • The Badge plugin currently does remove only badges and only summaries in respective methods, so going with this option is arguably least-surprise as well (ecosystem wide coherence as well as intuitively matching the name to activity).

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

Testing done

None yet, a theoretical fix.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
    • Subject to maybe going with the second option described above and using different names in the end
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

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 :)
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.

1 participant