Kill containers running days

This commit is contained in:
retropikzel 2026-01-11 08:52:18 +02:00
parent d1ca508100
commit cad4844d66
2 changed files with 7 additions and 4 deletions

8
Jenkinsfile vendored
View File

@ -4,7 +4,7 @@ pipeline {
} }
triggers { triggers {
cron('0 0 * * 6') cron('0 0 * * *')
} }
options { options {
@ -17,8 +17,8 @@ pipeline {
label 'agent1' label 'agent1'
} }
steps { steps {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f' sh 'docker system prune -a -f'
sh 'docker network prune -f'
} }
} }
stage('Clean docker images agent2') { stage('Clean docker images agent2') {
@ -26,8 +26,8 @@ pipeline {
label 'agent2' label 'agent2'
} }
steps { steps {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f' sh 'docker system prune -a -f'
sh 'docker network prune -f'
} }
} }
stage('Clean docker images agent3') { stage('Clean docker images agent3') {
@ -35,8 +35,8 @@ pipeline {
label 'agent3' label 'agent3'
} }
steps { steps {
sh 'sh kill_days_containers.sh'
sh 'docker system prune -a -f' sh 'docker system prune -a -f'
sh 'docker network prune -f'
} }
} }
} }

3
kill_days_containers.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
sudo docker ps | grep "days" | sudo docker kill $(awk '{print($1);}')