SHARE
TWEET

Untitled

a guest Aug 19th, 2019 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pipeline {
  2.         agent { label "build-docker" }
  3.         triggers { cron('@midnight') }
  4.    
  5.         stages {
  6.             stage('disk before') {
  7.                 steps {
  8.                     sh 'df -h'
  9.                 }
  10.             }
  11.    
  12.             stage('rm dangling volumes') {
  13.                 steps {
  14.                     sh 'docker volume ls -qf dangling=true | xargs -r docker volume rm'
  15.                 }
  16.             }
  17.            
  18.             stage('rm workspace data') {
  19.                 steps {
  20.                     sh 'cd /home/jenkins/workspace/ && du -m --max-depth=1 | awk "$1 > 300 && $1 < 400" | cut -f 2 | xargs -r sudo rm -rf'
  21.                 }
  22.             }
  23.            
  24.             stage('disk after') {
  25.                 steps {
  26.                     sh 'df -h'
  27.                 }
  28.             }
  29.         }
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top