Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jimklimov opened this issue Jan 5, 2022 · 1 comment · Fixed by #101
Closed

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

jimklimov opened this issue Jan 5, 2022 · 1 comment · Fixed by #101

Comments

@jimklimov
Copy link
Contributor

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>
@vilarion
Copy link

Hi @jimklimov!
If you are still looking for this, I found that removeSummaries(id:'some id') and removeSummaries() exist and work for summaries like removeBadges works for badges.
These seem to be missing in the documentation, though.

andreasgrob added a commit to andreasgrob/badge-plugin that referenced this issue Jun 2, 2023
removeSummaries already exists with tests, but was never documented.
Resolves jenkinsci#45.
andreasgrob added a commit to andreasgrob/badge-plugin that referenced this issue Jun 2, 2023
removeSummaries already exists with tests, but was never documented.
Resolves jenkinsci#45.
MarkEWaite pushed a commit that referenced this issue Jun 2, 2023
removeSummaries already exists with tests, but was never documented.
Resolves #45.
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 a pull request may close this issue.

2 participants