Jenkins plugin to display an icon representing the trigger cause of a build directly in the build history. It lets you quickly know which cause triggered a build.
Note: after installation, the plugin will currently only add icons on new builds. Old builds won't have the indicator.
-
Adding a badge for a cause defined in a public plugin should be straightforward. We basically only need the fully qualified name (FQN) of that build cause, and an icon. File a feature request.
-
Adding a cause coming from a private/custom plugin, or overriding some badge is possible since version 2.0. Extend
BuildTriggerBadgeProvider
, and implement theprovideIcon
method to match your needs. See Jenkins Symbols.@Extension public class MyProvider extends BuildTriggerBadgeProvider { @Override public String provideIcon(Cause cause) { if (cause instanceof SCMTriggerCause) { return "symbol-git-commit-outline plugin-ionicons-api"; } return null; } }
-
Disable a badge for a given cause. Let's say you want to disable the badge for the typical periodic timer (
TimerTriggerCause
), then just extends theBuildTriggerBadgeDeactivator
extension point and deploy your plugin.@Extension public class MyDeactivator extends BuildTriggerBadgeDeactivator { @Override public boolean vetoBadge(Cause cause) { if (cause instanceof TimerTriggerCause) { // Disabling badge for timertriggercause, yay!! return true; } return false; } }
This means the cause of the build is not yet supported by the plugin. It's pretty easy to add one, we basically only need the fully qualified name (FQN) of that build cause, and an icon.
Finding out that FQN is pretty easy. You can simply use the Jenkins API through your browser.
Open the build page, and suffix it with /api/xml?xpath=//cause&wrapper=causes
. To give something like: https://yourjenkinsserver/job/somejob/15/api/xml?xpath=//cause&wrapper=causes
Then, paste that output in a Improvement Request explaining your case. Even better, filing a pull-request would be great.
Refer to our contribution guidelines
Please report issues and enhancements through the Jenkins issue tracker.