-
New Feature
-
Resolution: Fixed
-
Minor
-
jenkins 2.113
badge-plugin 1.2
The new DSL addBadge() allow to create a new badge directly from the pipeline.
How to remove it later on ? In our workflow, there are several pauses waiting for user input, and at each stage we are displaying a different icons (removing previous one and adding a different one).
Here a workaround:
def removeBadges(RunWrapper build, String icon = null) { List<Action> actions = build.getRawBuild().getActions() List<BuildBadgeAction> badgeActions = build.getRawBuild().getActions(BuildBadgeAction.class) for(BuildBadgeAction action : badgeActions) { if (icon == null || action.iconPath == icon) { actions.remove(action) } } }
Would need a removeBadge(icon) and removeAllBadges() methods to do it directly in the pipeline.