orjan / build-discarder-plugin

Jenkins plugin extending the global build discarder functionality

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins Build Discarder Plugin

Github Build Jenkins Build Jenkins Plugin GitHub release

Introduction

A global build discarder that's possible to override by adding a job specific discarder. The goal is to be able to have a global sensible default, that's possible to override if needed.

Getting started

The Default Build Discarder can be added here:
Manage Jenkins >> Configure System >> Global Build Discarders Alt text

Configuration as Code

Add defaultBuildDiscarder to your configuredBuildDiscarders with the standard logRotator settings.

unclassified:
  buildDiscarders:
    configuredBuildDiscarders:
    - "jobBuildDiscarder"
    - defaultBuildDiscarder:
        discarder:
          logRotator:
            artifactDaysToKeepStr: "50"
            artifactNumToKeepStr: "5"
            daysToKeepStr: "100"
            numToKeepStr: "10"

Override the settings with a job specific discarder

Adding a job specific discarder will make sure the Default Build Discarder is not applicable.

# Jenkinsfile
pipeline {
  options {
    buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
  }
  ...
}

Background

The build in Specific Build Discarder discards build independent of specific job discarders.

Contributing

See the default contribution guidelines for Jenkins

Local development

Start Jenkins by running this command

mvn hpi:run

About

Jenkins plugin extending the global build discarder functionality

License:MIT License


Languages

Language:Java 100.0%