Reputation: 1169
Is it possible to filter the build history in Jenkins so that only builds with a specific label or parameter show up?
Let's say I have some job that is parametrized. One of the parameters is a simple string which can either be "experimental" or "official". Is there any plugin which lets me filter the build history to only show the "official" builds?
Upvotes: 16
Views: 19025
Reputation: 325141
Out of the box Jenkins supports a quicksearch over the build history that matches by label (description). Anything you put in the label can be used in the search:
... so you can use any plugin that can change the build label to add the info you want, then use quicksearch. The above example used the Pipeline plugin with the Groovy postbuild plugin, but you could use anything you feel like; say the description setter plugin or job name setter plugin.
You can then inject things like parameters into the job name. It's ugly, and annoying, and verbose. And there's no convenient way to save canned filters. But it works.
This workaround has a number of deficiencies:
which is why many people use:
If you want canned filters and convenient saved views, the widely used workaround at the moment seems to be to use the Jenkins Job Builder, a job template plugin, etc, to spawn lots of similar jobs. Use separate jobs to manage separate suites of parameters, etc. Then use Views to group up the jobs how you want.
I haven't found any pre-existing plugin to do it. You could implement your own Item that provides a custom job display and/or override the "Build History" list, but I haven't found any canned ones yet.
The Build History UI element is the BuildHistoryWidget
(BuildHistoryWidget.java
). It implements ExtensionPoint
so you can override it with an @Extension
. You shouldn't need to patch Jenkins.
A Google search for "extends HistoryWidget" -"class BuildHistoryWidget"
failed to find any existing implementations.
If you use Pipeline (Workflow) jobs, you may wish to consider extending or modifying the Pipeline Stage View Plugin to meet your needs.
It looks like it's designed to be somewhat extensible. See pipeline-staged.hbs.
Upvotes: 11
Reputation: 3461
You can do it via this plugin https://wiki.jenkins-ci.org/display/JENKINS/View+Job+Filters
The needed section for reading is "Filter by Job Parameterization"
Upvotes: 2