jenkins-automaintenance/Jenkinsfile

63 lines
1.6 KiB
Groovy

pipeline {
agent {
label 'linux'
}
triggers {
cron('@daily')
}
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
}
stages {
stage('Clean docker images agent1') {
agent {
label 'agent1'
}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f'
}
}
}
stage('Clean docker images agent2') {
agent {
label 'agent2'
}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f'
}
}
}
stage('Clean docker images agent3') {
agent {
label 'agent3'
}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f'
}
}
}
stage('Clean docker images agent4') {
agent {
label 'agent3'
}
steps {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f'
}
}
}
}
}