-
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 ] |
Code changed in jenkins
User: bakito
Path:
README.md
src/main/java/com/jenkinsci/plugins/badge/action/AbstractBadgeAction.java
src/main/java/com/jenkinsci/plugins/badge/action/BadgeAction.java
src/main/java/com/jenkinsci/plugins/badge/action/BadgeSummaryAction.java
src/main/java/com/jenkinsci/plugins/badge/action/HtmlBadgeAction.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AbstractRemoveBadgesStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AbstractStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AddBadgeStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AddErrorBadgeStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AddHtmlBadgeStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AddInfoBadgeStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/AddWarningBadgeStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/CreateSummaryStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/RemoveAllBadgesStep.java
src/main/java/com/jenkinsci/plugins/badge/dsl/RemoveHtmlBadgesStep.java
src/main/resources/com/jenkinsci/plugins/badge/dsl/AddBadgeStep/config.jelly
src/main/resources/com/jenkinsci/plugins/badge/dsl/AddErrorBadgeStep/config.jelly
src/main/resources/com/jenkinsci/plugins/badge/dsl/AddHtmlBadgeStep/config.jelly
src/main/resources/com/jenkinsci/plugins/badge/dsl/AddInfoBadgeStep/config.jelly
src/main/resources/com/jenkinsci/plugins/badge/dsl/AddShortTextStep/config.jelly
src/main/resources/com/jenkinsci/plugins/badge/dsl/AddWarningBadgeStep/config.jelly
src/main/resources/com/jenkinsci/plugins/badge/dsl/CreateSummaryStep/config.jelly
src/test/java/com/jenkinsci/plugins/badge/dsl/ShortTextStepTest.java
src/test/java/com/jenkinsci/plugins/badge/readme/DescribeStepTag.java
http://jenkins-ci.org/commit/badge-plugin/8d41519d9111fc4c138f48ff972f03150a0b7cf2
Log:
add removeBadges methods https://issues.jenkins-ci.org/browse/JENKINS-50442