Skip to content

Apply badge plugin multi version compatibilty fixes.#7378

Open
steelhead31 wants to merge 2 commits into
adoptium:masterfrom
steelhead31:fix_badge_plugin_v3_issues
Open

Apply badge plugin multi version compatibilty fixes.#7378
steelhead31 wants to merge 2 commits into
adoptium:masterfrom
steelhead31:fix_badge_plugin_v3_issues

Conversation

@steelhead31

@steelhead31 steelhead31 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #7377

Fix createBadgeSummary compatibility with Badge Plugin 1.x, 2.x, and 3.x

Problem

After upgrading to Badge Plugin 3.x, build summaries fail with:

No signature of method: org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager.addSummary()
is applicable for argument types: (java.lang.String) values: [warning.svg]

The previous implementation assumed manager.addSummary(iconName) was the Badge Plugin 3.x API.
It is not — in 3.x, addSummary is a Pipeline DSL step invoked without a manager. prefix and
takes named parameters (icon:, text:). Additionally, Badge Plugin 3.x ships no bundled image
files; icons must be provided via the ionicons-api plugin using symbol name strings.

Root Cause

Plugin version Correct API Icon format
1.x manager.createSummary(icon) .svg filename
2.x manager.addSummary(icon) .svg filename
3.x addSummary(icon: ..., text: ...) Ionicons symbol string

The previous code tried manager.addSummary(iconName) first (not valid in any version as the
primary call) and fell back to manager.createSummary(iconName) — passing a 3.x Ionicons symbol
string that older plugin versions cannot resolve.

Changes

buildenv/jenkins/JenkinsfileBase

  • Added import groovy.transform.Field to support the new static map.
  • Added ICON_LEGACY_FALLBACK — a static map translating Ionicons symbol strings to their .svg
    equivalents for use with Badge Plugin 1.x and 2.x.
  • Rewrote createBadgeSummary with a correct three-level fallback chain:
    1. 3.xaddSummary(icon: iconName, text: '') (Pipeline DSL step)
    2. 2.xmanager.addSummary(legacyIcon) (manager method, .svg icon name)
    3. 1.xmanager.createSummary(legacyIcon) (Groovy Postbuild API, .svg icon name)
  • Updated all four createBadgeSummary call sites to pass Ionicons symbol strings, which are
    automatically downgraded to .svg names on older installs via the fallback map.
  • appendSummaryText is unchanged — its existing setText/getTextappendText fallback
    already handles the 1.x vs 2.x/3.x text API difference correctly.

Icon mapping

Ionicons symbol (3.x) Legacy .svg fallback (1.x / 2.x) Used for
symbol-close-circle-outline plugin-ionicons-api error.svg Test build failure
symbol-warning-outline plugin-ionicons-api warning.svg Tests with failures
symbol-checkmark-circle-outline plugin-ionicons-api accept.svg All tests passed
symbol-folder-open-outline plugin-ionicons-api folder-delete.svg No tests found

Assisted by IBM Bob

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates createBadgeSummary in the Jenkins pipeline to work across Badge Plugin 1.x, 2.x, and 3.x by using the correct API per version and introducing an icon fallback mapping so newer Ionicons symbols can be downgraded to legacy .svg icon names when needed.

Changes:

  • Added a static icon mapping to translate Badge Plugin 3.x Ionicons symbol strings into legacy .svg icon names for 1.x/2.x.
  • Reworked createBadgeSummary to try the 3.x Pipeline step first, then fall back to 2.x manager.addSummary, then 1.x manager.createSummary.
  • Updated call sites to pass Ionicons symbol strings so 3.x works directly while older versions use the fallback map.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread buildenv/jenkins/JenkinsfileBase Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@smlambert

Copy link
Copy Markdown
Contributor

Some Grinders here:

@steelhead31
steelhead31 marked this pull request as ready for review July 17, 2026 13:57

@smlambert smlambert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These changes almost feel like it should get upstreamed to fix the plugin directly. But happy to hold them here for now.

@karianna

Copy link
Copy Markdown
Contributor

@steelhead31 Is it worth chatting to the upstream project here?

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.

Error With Newest Version Of Badge Plugin

4 participants