×
Find plugins

Build History Manager
1.0.0Minimum Jenkins requirement: 2.138.4ID: build-history-manager

Installs: 17
Last released: 2 days ago
Maintainers
Damian Szczepanik

Travis Status Appveyor status Shippable Status

Coverage Status Codebeat badge Codacy badge Vulnerabilities CII Best Practices

Installs Version

Jenkins plugin that allows to build complex rules to define which builds should be removed from the history and which preserved.

Usage

The motivation of creating this plugin is to deliver powerful tool that allows to define rules that are built from two types of objects:

Example

Following configuration has two rules. First one makes sure that the newest build with failure status is not deleted. Second deletes all builds which are not success. In other words it keeps the most recent broken build and all stables.

pipeline {
   agent any

    options {
        buildDiscarder(BuildHistoryManager([
            [
                conditions: [
                    BuildResult(matchFailure: true)
                ],
                matchAtMost: 1,
                continueAfterMatch: false
            ],
            [
                conditions: [
                    BuildResult(matchAborted: true, matchFailure: true, matchUnstable: true)
                ],
                actions: [DeleteBuild()]
            ]
        ]))
    }
}

Conditions

Following simple configuration allows to save last 5 builds, rest will be deleted: Condition filters out builds which should be performed by actions. So plugin can filter builds by:

Actions

Actions defines how the build filtered by above condition) should be modified. Plugin can:

  • mark the build to be kept forever
  • delete the build
  • delete artifacts

Wiki

Read Wiki for more details. Check also information how to avoid problems when creating rules.

There is possibility to build complex rules. Each rule can define more than single condition and action. Plugin starts as BuildDiscarder class. Core method that is responsible for processing conditions and actions are stored in Rule.perform() method.

Configuration

feature overview page

Use cases

Using conditions and actions there is easy to realize following scenarios:

  • Delete builds which are unstable or aborted if they are not valuable from the history/audit point of view.
  • Keep only last build per result. So the history contain the most recent builds for result aborted, unstable, failure and success.
  • Keep builds only from master branch if the project builds all branches including feature branches
  • Remove builds which have build number lower than given value to easily drop all old builds at once.

Code quality

Once you developed your new feature or improvement you should test it by providing several unit or integration tests.

codecov.io

Release notes

Check release notes for changelog details.

Contribution

If you find the issue you can send pull request to fix it or file the bug. The same about missing Action or Condition Remember about:

  • doing tests on your local Jenkins instance
  • adding new unit tests according to given -> when -> then approach.
ArchivesGet past versions
Links
Labels
This plugin has no labels