Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pipeline {
- agent { label "build-docker" }
- triggers { cron('@midnight') }
- stages {
- stage('disk before') {
- steps {
- sh 'df -h'
- }
- }
- stage('rm dangling volumes') {
- steps {
- sh 'docker volume ls -qf dangling=true | xargs -r docker volume rm'
- }
- }
- stage('rm workspace data') {
- steps {
- sh 'cd /home/jenkins/workspace/ && du -m --max-depth=1 | awk "$1 > 300 && $1 < 400" | cut -f 2 | xargs -r sudo rm -rf'
- }
- }
- stage('disk after') {
- steps {
- sh 'df -h'
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement