Skip to content

Commit 46474e9

Browse files
committed
switch policy depending on branch
Signed-off-by: Sombrio <[email protected]>
1 parent b5ed057 commit 46474e9

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

jenkins/public_nightly.Jenkinsfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
node {
44

5+
def isDefaultBranch = (env.BRANCH_NAME == 'master')
6+
def daysToKeep = (isDefaultBranch ? '30' : '-1');
7+
def numToKeep = (isDefaultBranch ? '-1' : '10');
8+
59
properties([
610
copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME),
711

812
buildDiscarder(logRotator(
9-
daysToKeepStr: '20',
10-
artifactDaysToKeepStr: '20'
13+
daysToKeepStr: daysToKeep,
14+
artifactDaysToKeepStr: daysToKeep,
15+
16+
numToKeepStr: numToKeep,
17+
artifactNumToKeepStr: numToKeep
1118
))
1219
]);
1320

jenkins/public_tests_all.Jenkinsfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
@Library('[email protected]') _
22

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

59
properties([
610
copyArtifactPermission('${JOB_NAME},'+env.BRANCH_NAME),
711

812
buildDiscarder(logRotator(
9-
daysToKeepStr: '30',
10-
artifactDaysToKeepStr: '30'
13+
daysToKeepStr: daysToKeep,
14+
artifactDaysToKeepStr: daysToKeep,
15+
16+
numToKeepStr: numToKeep,
17+
artifactNumToKeepStr: numToKeep
1118
))
1219
]);
1320

0 commit comments

Comments
 (0)