Add columns to build history in Jenkins
Asked Answered
D

2

1

I would like to add extra columns to the build history sidebar that can be modified by user (comments,etc..).

Has anyone did something similar? or any suggestions how can it done easily?

Dobb answered 25/8, 2016 at 8:13 Comment(0)
P
0

You cannot add columns to the build history without digging deeper into the Jenkins-internal layout engine.

The simplest solution to achieve what you want is to use the "Edit Build Information" menu item for a build. Users can add information there, and it's also possible to add HTML code with tables etc there, which can then look nicely in the build history.

It's not as interactive as what you're looking for, though, and it requires some discipline from your users to avoid that they destroy the build history format completely.

If you only need comments for failed builds, then the Claim plugin is a nice solution.

Perimeter answered 25/8, 2016 at 9:8 Comment(0)
R
0

I know this is a very old post, but I stumbled over the same problem recently. My goal was to display an icon with a tooltip next to each run in the build history. You can extend this approach to add an image with a link or even a short custom text.

enter image description here

I was able to accomplish this by using the badge plugin. Keep in mind that your Jenkins instance needs to have the Badge plugin installed as well.

  1. Add the badge plugin to your pom.xml
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>badge</artifactId>
      <version>1.13</version>
    </dependency>
  1. Create a custom RunListener, override the onCompleted method and add the badge
@Extension
public class BadgeIconRunListener extends RunListener<Run<?, ?>> {

    @Override
    public void onCompleted(Run<?, ?> run, TaskListener listener) {

        ...
        run.addAction(BadgeAction.createBadge("path/to/icon", "Tooltip"));
        ...

        try {
            run.save(); // saves the actions to the run's build.xml file
        } catch (IOException e) {
            // error handling
        }
    }
}
Rabinowitz answered 27/7 at 12:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.