Adds one or more badges to the current Pipeline build.
Badges are symbols or icons with an optional text message and an optional clickable hyperlink.
Badges are often used to provide a visual indicator of additional status information about a Pipeline build.
Badges added by addBadge
are displayed in the build history of the Pipeline job.
The plugin supports symbols from the ionicons library through the ionicons-api-plugin. More symbols can be added by installing additional plugins, such as font-awesome-api-plugin or custom-folder-icon-plugin. Symbols are referenced as "symbol-icon-name plugin-plugin-name". For example, the following are all valid references to symbols from the ionicons library:
addBadge icon: 'symbol-alert-circle-outline plugin-ionicons-api', text: 'This is an alert symbol'
addBadge icon: 'symbol-bar-chart-filled plugin-ionicons-api', text: 'This is a bar chart symbol'
addBadge icon: 'symbol-battery-half-sharp plugin-ionicons-api', text: 'This is a half filled battery symbol'
addBadge icon: 'symbol-flag-outline plugin-ionicons-api', text: 'This is a flag symbol'
addBadge icon: 'symbol-mic plugin-ionicons-api', text: 'This is a microphone symbol'
addBadge icon: 'symbol-rocket-filled plugin-ionicons-api', text: 'This is a rocket'
addBadge icon: 'symbol-unlink-sharp plugin-ionicons-api', text: 'This is an unlink symbol'
The plugin includes icons as GIF images and also supports the 16x16 icons that are offered by Jenkins. These icons are listed in the plugin documentation and are referenced as "image-name.gif". For example, the following are all valid references to icons included with the plugin:
addBadge icon: 'completed.gif', text: 'This is a completed symbol'
addBadge icon: 'delete.gif', text: 'This is a delete icon'
addBadge icon: 'save.gif', text: 'This is a save icon'
addBadge icon: 'success.gif', text: 'This is a success icon'
addBadge icon: 'warning.gif', text: 'This is a warning icon'
The Pipeline Syntax Snippet Generator guides the user to select badge options and provides online help for the options.
Example: Badge with completed iconThe following example adds a "completed" checkmark icon with the text, "This is completed":
addBadge icon: 'completed.gif', text: 'This is completed'
Example: Badge with alarm symbol
The following example adds an alarm badge in outline format with the text, "This is alarming":
addBadge icon: 'symbol-alarm-outline plugin-ionicons-api', text: 'This is alarming'
Example: Badge with red bug symbol
The following example adds a red bug badge with the text, "This is a red bug with a link", and a link to a bug report:
addBadge icon: 'symbol-bug plugin-ionicons-api',
text: 'This is a red bug with a link',
color: 'red',
link: 'https://issues.jenkins.io/browse/JENKINS-59646'