Skip to content

Commit 7598c89

Browse files
authored
Merge pull request #3124 from sombraSoft/build-discard-policy
Added build retention policy for multi-branch pipeline
2 parents 23886c4 + 39db69b commit 7598c89

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

jenkins/public_tests_all.Jenkinsfile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
@Library('[email protected]') _
22

33
node {
4+
5+
def isDefaultBranch = (env.BRANCH_NAME == 'master')
6+
def daysToKeep = '20';
7+
def numToKeep = (isDefaultBranch ? '-1' : '10');
48

5-
properties([copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME)]);
9+
properties([
10+
copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME),
11+
12+
buildDiscarder(logRotator(
13+
daysToKeepStr: daysToKeep,
14+
artifactDaysToKeepStr: daysToKeep,
15+
16+
numToKeepStr: numToKeep,
17+
artifactNumToKeepStr: numToKeep
18+
))
19+
]);
620

721
stage('Checkout') {
822
if (env.BRANCH_NAME && env.BRANCH_NAME == 'master') {

0 commit comments

Comments
 (0)