Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement