-
Notifications
You must be signed in to change notification settings - Fork 10
/
GarbageCollector
35 lines (29 loc) · 1.16 KB
/
GarbageCollector
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!groovy
library identifier: "upstream-fedora-pipeline@master",
retriever: modernSCM([$class: 'GitSCMSource',
remote: "https://github.com/CentOS-PaaS-SIG/upstream-fedora-pipeline"])
//noinspection GroovyAssignabilityCheck
properties(
[
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '15', daysToKeepStr: '', numToKeepStr: '15')),
disableConcurrentBuilds(),
pipelineTriggers([cron('0 */2 * * *')])
]
)
def stepName = null
node() {
timeout(time: 30, unit: 'MINUTES') {
try {
stepName = 'Garbage Collection'
stage(stepName) {
// Garbage collect all qcow2 images over a day old
sh 'find /var/lib/jenkins/jobs/fedora-*-*-pipeline/ -mtime +1 -name "*.qcow2" -exec rm -f {} \\;'
currentBuild.result = 'SUCCESS'
}
} catch (Throwable err) {
currentBuild.description = "Find Failure"
error "Find and deletion of old qcow2 images failed!"
currentBuild.result = 'FAILURE'
}
}
}