Skip to content

A Jenkins plugin to perform rotation of build history with low memory pressure.

License

Notifications You must be signed in to change notification settings

heremaps/buildrotator-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Rotator Plugin

A Jenkins plugin which allows to perform rotation of build history with low memory pressure.

Table of contents

  1. Overview
  2. Building
  3. Basic Usage
  4. Authors
  5. License

Overview

The reason we created this plugin is because we found the default rotation in Jenkins to use a lot of memory. In our case 25% percent of memory footprint was related to job history rotation alone. This is caused by an implementation detail of the default implementation: It guarantees that if you want to keep only last X builds in history, it would keep exactly X builds. The main idea of this plugin is to make a little bit different guarantee: If you want to keep only last X builds in history, it would keep a maximum of X builds.

Here are some examples to illustrate the difference.

Let us assume that we have 5 builds in history and we want to keep 5 builds:

  • build1
  • build2
  • build3
  • build4
  • build5

After that you want to remove build3, because it is broken. So, now you have only:

  • build1
  • build2
  • build4
  • build5

And after build6 just finished:

  • build1
  • build2
  • build4
  • build5
  • build6

The Log Rotator strategy in this case would load the entire history in memory to check whether there are 5 builds in reality or not, and it would not delete anything at the end. As a result the list would be the same:

  • build1
  • build2
  • build4
  • build5
  • build6

The Build Rotator is checking only the difference between last build number and the number of builds it should keep. And if it's more than 5, it would remove the first build. So, afterwards you would have:

  • build2
  • build4
  • build5
  • build6

More importantly, Build Rotator respects all other aspects of rotation in same way as the Log Rotator strategy. IN particular, it does not remove:

  • Builds that have "Keep log" enabled.
  • The "Last successful build" in the history.
  • The "Last stable build" in the history.
  • An ongoing build.

Building

Prerequisites:

  • JDK 7 (or above)
  • Apache Maven

Build process is quite simple:

mvn install

Basic Usage

To get started:

  1. Install the plugin.
  2. Go to the Jenkins Configuration.
  3. Enable on "Discard Old Builds".
  4. Set the "Build Rotator" strategy.

Authors

Alexander Akbashev - [email protected]

License

Licensed under the MIT License (MIT).

About

A Jenkins plugin to perform rotation of build history with low memory pressure.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages