From d5cc24fecf611ab9c436db32f078bc22f8c2d70b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Tue, 21 Feb 2023 19:13:20 +0100 Subject: [PATCH] ci: add Xcode cleanup Jenkinsfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Too often Xcode derived data and archives are clogging up hosts. Signed-off-by: Jakub SokoĊ‚owski --- ci/tools/Jenkinsfile.xcode-clean | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 ci/tools/Jenkinsfile.xcode-clean diff --git a/ci/tools/Jenkinsfile.xcode-clean b/ci/tools/Jenkinsfile.xcode-clean new file mode 100644 index 0000000000..7000a36600 --- /dev/null +++ b/ci/tools/Jenkinsfile.xcode-clean @@ -0,0 +1,47 @@ +library 'status-jenkins-lib@v1.6.6' + +pipeline { + agent { + label 'linux' + } + + triggers { + cron('H 5 * * *') + } + + options { + timestamps() + /* Prevent Jenkins jobs from running forever */ + timeout(time: 15, unit: 'MINUTES') + /* Disable concurrent jobs */ + disableConcurrentBuilds() + /* Don't keep more than 50 builds */ + buildDiscarder(logRotator(numToKeepStr: '10')) + } + + stages { + stage('Get Nodes') { + steps { script { + stagePerNode = nodesByLabel('macos').collectEntries { + ["${it}" : generateNodeCleanupStage(it)] + } + } } + } + + stage('Clean Xcode') { + steps { script { + parallel stagePerNode + } } + } + } +} + +def generateNodeCleanupStage(nodeLabel) { + return { stage(nodeLabel) { + node(nodeLabel) { + dir('/Users/jenkins/Library/Developer/Xcode') { + sh 'rm -fr Archives DerivedData' + } + } + } } +}