From d54f880e5e8cab3d815f6ad1e5312e7159980180 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Sun, 21 May 2017 20:44:23 +0200 Subject: [PATCH] Jenkinsfile: Don't keep artifacts for old PR builds --- Jenkinsfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1d8028dc..84e65471 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,9 @@ #!/usr/bin/env groovy -properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '10']]]) +if (env.BRANCH_NAME.startsWith('PR-')) { + properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactNumToKeepStr: '1']]]) +} else { + properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '5']]]) +} node('master') { stage('Pull changes') { @@ -22,7 +26,7 @@ node('master') { sh 'rm -f data.zip' zip zipFile: 'data.zip', archive: true, dir: 'build/install' } - + // Clean workspace after building pull requests // to save disk space on the Jenkins host if (env.BRANCH_NAME.startsWith('PR-')) {