Skip to content

Commit

Permalink
Keep most recent NOT_BUILT build, too
Browse files Browse the repository at this point in the history
  • Loading branch information
ao-apps committed Apr 13, 2023
1 parent b85cd44 commit 12f3169
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
11 changes: 10 additions & 1 deletion book/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 12f3169

Please sign in to comment.