From 4835968fcdf44ec759f91dbeafec71bf059de42e Mon Sep 17 00:00:00 2001 From: Stamatis Zampetakis Date: Wed, 3 Jul 2024 13:59:19 +0200 Subject: [PATCH] HIVE-28359: Discard old builds in Jenkins to avoid disk space exhaustion (Stamatis Zampetakis reviewed by Zoltan Haindrich) Currently Jenkins retains the builds from all active branches/PRs leading to disk space exhaustion and CI failures requiring manual intervention to restore the services. Close apache/hive#5332 --- Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index fc11bb3299ea..ce05c408e8ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,14 @@ * limitations under the License. */ +def discardDaysToKeep = '365' +def discardNumToKeep = '' // Unlimited +if (env.BRANCH_NAME != 'master') { + discardDaysToKeep = '60' + discardNumToKeep = '5' +} properties([ + buildDiscarder(logRotator(daysToKeepStr: discardDaysToKeep, numToKeepStr: discardNumToKeep)), // max 5 build/branch/day rateLimitBuilds(throttle: [count: 5, durationName: 'day', userBoost: true]), // do not run multiple testruns on the same branch