-
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.
[JENKINS-50442] Adding removeBadge(icon) and removeAllBadges() methods to remove existing badges
Description |
Original:
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). I'm was so far doing something like: {code:java} def removeBadges(RunWrapper build) { List<Action> actions = build.getRawBuild().getActions() List<GroovyPostbuildAction> badgeActions = build.getRawBuild().getActions(GroovyPostbuildAction.class) for(GroovyPostbuildAction action : badgeActions) { actions.remove(action) } } {code} Would need a *removeBadge(icon)* and *removeAllBadges()* methods to do it directly in the pipeline. |
New:
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: {code:java} 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 {code} *removeBadge(icon)* {code:java} and {code} *removeAllBadges()* {code:java} methods to do it directly in the pipeline. {code} |
Description |
Original:
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: {code:java} 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 {code} *removeBadge(icon)* {code:java} and {code} *removeAllBadges()* {code:java} methods to do it directly in the pipeline. {code} |
New:
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: {code:java} 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) } } } {code} Would need a *removeBadge(icon)* and *removeAllBadges()* methods to do it directly in the pipeline. |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10005 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Review [ 10005 ] | New: Resolved [ 5 ] |
Status | Original: Resolved [ 5 ] | New: Closed [ 6 ] |