Skip to content

Can't removeBadge(id) for a createSummary(icon, id, txt) entry #45

@jimklimov

Description

@jimklimov

Describe the bug
I am trying to add a rolling update of my build status, by posting short texts into the build history column and into the summary page. These texts are posted with an ID, so I would remove the older entry when I post a new one.

In case of createSummary(), the README does imply that the id field allows to remove the entry later - but at least removeBadge() did not work for it (works for the "usual" badges though not instantaneously - sometimes several older entries remain and then disappear all at once).

To Reproduce
Pipeline runs a loop, each cycle of which calls this logic at the end to update the progress info:

            this.script.removeBadges(id: "Build-progress-summary@" + this.objectID)
            this.script.createSummary(icon: 'info.gif', text: txt, id: "Build-progress-summary@" + this.objectID)

Expected behavior
I expected the older summary entry to disappear and only the latest to be seen.

Screenshots

As seen in the build summary page (never mind the blank icon areas):

jenkins-badge--createSummary-not-removed

Additional context
I wonder if this is linked to the summary step creating a different kind of object (than the left-column badges that can be removed). Notably, only one XML tag with the ID of a "badge" is present at any time as seen in the build.xml file, but many tags with the same ID of a "summary" are present:

// "Usual" badge from addShortText()
    <com.jenkinsci.plugins.badge.action.BadgeAction plugin="badge@1.9">
      <text>Running 378 &apos;slow build&apos; dynamatrix stages</text>
      <color>#000000</color>
      <background>#FFFF00</background>
      <border>1px</border>
      <borderColor>#C0C000</borderColor>
    </com.jenkinsci.plugins.badge.action.BadgeAction>

...

    <com.jenkinsci.plugins.badge.action.BadgeSummaryAction plugin="badge@1.9">
      <id>Build-progress-summary@2680ed6</id>
      <iconPath>info.gif</iconPath>
      <summaryText>Build in progress: [STARTED:5]</summaryText>
    </com.jenkinsci.plugins.badge.action.BadgeSummaryAction>

...

    <com.jenkinsci.plugins.badge.action.BadgeAction plugin="badge@1.9">
      <id>Build-progress-badge@2680ed6</id>
      <iconPath>/plugin/badge/images/info.gif</iconPath>
      <text>Build in progress: [STARTED:126, COMPLETED:111, SUCCESS:111]</text>
      <color>#000000</color>
      <background>#FFFF00</background>
      <border>1px</border>
      <borderColor>#C0C000</borderColor>
    </com.jenkinsci.plugins.badge.action.BadgeAction>

...

    <com.jenkinsci.plugins.badge.action.BadgeSummaryAction plugin="badge@1.9">
      <id>Build-progress-summary@2680ed6</id>
      <iconPath>info.gif</iconPath>
      <summaryText>Build in progress: [STARTED:129, COMPLETED:114, SUCCESS:113, UNSTABLE:1]</summaryText>
    </com.jenkinsci.plugins.badge.action.BadgeSummaryAction>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions