From 12f3169173536d2e92d379b7422543ecd9943646 Mon Sep 17 00:00:00 2001 From: "AO Industries, Inc" Date: Thu, 13 Apr 2023 02:18:04 +0000 Subject: [PATCH] Keep most recent NOT_BUILT build, too Requires build-history-manager-1.7.0 or newer: https://github.com/jenkinsci/build-history-manager-plugin/releases/tag/build-history-manager-1.7.0 --- Jenkinsfile | 11 ++++++++++- book/Jenkinsfile | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 975d9a7..e43e8e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -550,6 +550,15 @@ pipeline { timeout(time: 2, unit: 'HOURS') // See https://plugins.jenkins.io/build-history-manager/ buildDiscarder(BuildHistoryManager([ + [ + // Keep most recent not_built build, which is useful to know which + // builds have been superseded during their quiet period. + conditions: [BuildResult( + matchNotBuilt: true + )], + matchAtMost: 1, + continueAfterMatch: false + ], [ // Keep most recent aborted build, which is useful to know what the build is waiting for // and to see that the build is still pending in Active and Blinkenlichten views. @@ -560,7 +569,7 @@ pipeline { continueAfterMatch: false ], [ - // Keep most recent 50 non-aborted builds + // Keep most recent 50 success/unstable/failure builds conditions: [BuildResult( // All statuses except ABORTED from // https://github.com/jenkinsci/build-history-manager-plugin/blob/master/src/main/java/pl/damianszczepanik/jenkins/buildhistorymanager/model/conditions/BuildResultCondition.java diff --git a/book/Jenkinsfile b/book/Jenkinsfile index af68724..0edbaf7 100644 --- a/book/Jenkinsfile +++ b/book/Jenkinsfile @@ -558,6 +558,15 @@ pipeline { timeout(time: 2, unit: 'HOURS') // See https://plugins.jenkins.io/build-history-manager/ buildDiscarder(BuildHistoryManager([ + [ + // Keep most recent not_built build, which is useful to know which + // builds have been superseded during their quiet period. + conditions: [BuildResult( + matchNotBuilt: true + )], + matchAtMost: 1, + continueAfterMatch: false + ], [ // Keep most recent aborted build, which is useful to know what the build is waiting for // and to see that the build is still pending in Active and Blinkenlichten views. @@ -568,7 +577,7 @@ pipeline { continueAfterMatch: false ], [ - // Keep most recent 50 non-aborted builds + // Keep most recent 50 success/unstable/failure builds conditions: [BuildResult( // All statuses except ABORTED from // https://github.com/jenkinsci/build-history-manager-plugin/blob/master/src/main/java/pl/damianszczepanik/jenkins/buildhistorymanager/model/conditions/BuildResultCondition.java