2.0
π New Major Version
The Badge Plugin has been completely reworked to overcome some limitations and bugs of previous versions and in order to be easier to maintain.
This release is expected to not cause incompatibilities with existing pipeline definitions and configuration on a technical level but may introduce some (minor) visual changes to existing badges and summaries. See the following secions as well as #151 and the README for more details.
In case you find a bug or potential incompatibility that may have slipped the extensive testing please do not hesitate to create a new issue.
π₯ Breaking Changes and Deprecations
The new new major version 2.0 is marked as be incompatible with previous versions and deprecates most of the previous pipeline steps and fields for these steps.
π₯ Incompatible downstream plugins
As of now the following plugins are incompatible with Badge Plugin 2.x:
- groovy-postbuild-plugin - See PR 81 - Please update to version
264.vf6e02a_77d5b_c
as compatible release - build-monitor-plugin - See PR 995 - Please update to version
1.14-925.v95b_9089a_4c7f
as compatible realease
Users of these plugins are advised to upgrade the Badge Plugin alongside compatible releases of the respective plugin.
π₯ HTML formatting delegated to global Jenkins MarkupFormatter
- Breaking: Remove Badge Plugin global configuration
- This will mostly affect usage in
JCasC
but also may impact some visualization, see next points
- This will mostly affect usage in
- All text is formatted using
Jenkins.get().getMarkupFormatter().translate()
- Breaking: It is no longer possible to use non-sanitized HTML in badges (unless there is a
MarkupFormatter
for it) - This is a huge security improvement that prevents any malicious injections via HTML / JavaScript and makes configuration easier
- Breaking: It is no longer possible to use non-sanitized HTML in badges (unless there is a
β What does that mean? Why is my text not rendered as HTML anymore?
As of now there are multiple MarkupFormatter implementation available. The default that is shipped with Jenkins is Plain Text
that will not render any HTML or any other markup languages.
In case you find that your badges or summaries created by the Badge Plugin are no longer rendering HTML in their texts, it is likely caused by the configured MarkupFormatter being Plain Text
.
To render HTML in badges and summaries you will need to change the global Jenkins Configuration to use Safe HTML
provided via OWASP Markup Formatter.
See the README for details.
β My Jenkins Configuration as Code (JCasC) fails to start Jenkins, what can I do?
Since the global plugin configuration got removed, the JCasC directives such as
jenkins:
security:
badgePlugin:
disableFormatHTML: false
are no longer valid and should be removed or better replaced by configuring Jenkins global MarkupFormatter
jenkins:
markupFormatter:
rawHtml:
disableSyntaxHighlighting: true
π§ Deprecations
At this point it is not clear when or if these deprecations will be removed, however use is discouraged and there are no plans to maintain deprecated functionallity.
- Deprecate
addHtmlBadge
(can be substituted byaddBadge
)- Remains backwards compatibility for existing pipelines and configs
- Add deprecation notices to build output
- Deprecate
addShortText
(can be substituted byaddBadge
)- Remains backwards compatibility for existing pipelines and configs
- Add deprecation notices to build output
- Deprecate
createSummary
(can be substituted byaddSummary
)- Remains backwards compatibility for existing pipelines and configs
- Add deprecation notices to build output
- Remove all documentation of deprecated badges
π New features and improvements
π addBadge
reworked
- Refrain from building CSS styles or classes in jelly but rather have them as user input
- All
text
can be plain text or HTML (withSafe HTML
MarkupFormatter enabled) - Can be used for both, text and icon badges
- Supports built-in icon, Jenkins icons and symbols as well as icons and symbols of other plugins
- New fields:
- id - optional identifier of the badge
- text - text used for the badge or the hover text when an icon is selected
- icon - icon used for the badge
- cssClass - optional CSS class to be applied to a badge
- style - optional CSS style to be applied to a badge
- link - optional link for a badge
π·πΌ addInfoBadge
, addWarningBadge
, addErrorBadge
reworked
- Inherit directly from
addBadge
π New addSummary
- Substitutes
createSummary
and has all feature the other badges have - Allows having a link in the summary
π Manipulate a badge during build time
- All pipeline steps now return the action that was created and allow to manipulate a badge in a pipeline
def badge = addBadge(icon: 'everything-is-awesome.png', text: 'All is good!') ... badge.setText('Somehing bad happened!') badge.setIcon('everything-is-on-fire.png')
π€ Generated Changelog
π New features and improvements
- Refactoring for new major version (#151) @strangelookingnerd
π Documentation updates
β Other changes
- Update Jenkins Security Scan action (#176) @strangelookingnerd
- Modernize to Jenkins 2.440.3 (#174) @sghill-rewrite
π¦ Dependency updates
22 changes
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3358 (#186) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3334 (#185) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3307 (#183) @renovate
- Update dependency org.jenkins-ci.plugins:plugin to v4.87 (#182) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3289 (#181) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3276 (#180) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3271 (#179) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3258 (#178) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.440.x to v3234 (#175) @renovate
- Update dependency org.jenkins-ci.plugins:plugin to v4.86 (#173) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.426.x to v3208 (#172) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.426.x to v3193 (#170) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.426.x to v3180 (#169) @renovate
- Update dependency org.jenkins-ci.plugins:plugin to v4.85 (#168) @renovate
- Update dependency org.jenkins-ci.plugins:plugin to v4.84 (#167) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.426.x to v3157 (#166) @renovate
- Update dependency io.jenkins.tools.bom:bom-2.426.x to v3143 (#165) @renovate
- Configure Renovate (#163) @strangelookingnerd
- chore(deps): bump io.jenkins.tools.bom:bom-2.426.x from 3120.v4d898e1e9fc4 to 3135.v6d6c1f6b_3572 (#162) @dependabot
- chore(deps): bump org.jenkins-ci.plugins:plugin from 4.82 to 4.83 (#160) @dependabot
- chore(deps): bump io.jenkins.tools.bom:bom-2.426.x from 3105.v672692894683 to 3120.v4d898e1e9fc4 (#161) @dependabot
- chore(deps): bump io.jenkins.tools.bom:bom-2.426.x from 3080.vfa_b_e4a_a_39b_44 to 3105.v672692894683 (#159) @dependabot