]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-api-nightly: Clean up after yourself 1653/head
authorDavid Galloway <dgallowa@redhat.com>
Thu, 3 Sep 2020 16:58:01 +0000 (12:58 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 3 Sep 2020 17:31:26 +0000 (13:31 -0400)
This job has a bunch of templates.  Each one reaches 30-50GB in size which quickly fills up our builder home dirs.

Signed-off-by: David Galloway <dgallowa@redhat.com>
ceph-api-nightly/build/cleanup [new file with mode: 0644]
ceph-api-nightly/config/definitions/ceph-api-nightly.yml

diff --git a/ceph-api-nightly/build/cleanup b/ceph-api-nightly/build/cleanup
new file mode 100644 (file)
index 0000000..b02d27a
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+use_percentage=$(df -m ~ | grep -v Filesystem | awk '{ print $5 }' | cut -d '%' -f1)
+if [ $use_percentage -gt 90 ]; then
+  rm -rf ~/.ccache
+  for dir in $(ls ~/build/workspace/); do
+    # Used "${var}" instead of ${var+x} here because I also want to check if the string is empty
+    if [ -z "${dir}" ] || [ -z "${JOB_NAME}" ]; then
+      echo "Either \$dir or \$JOB_NAME aren't set.  Not cleaning up job directories."
+    else
+      if [ "$dir" != "$JOB_NAME" ]; then
+        rm -rf ~/build/workspace/$dir
+      fi
+    fi
+  done
+fi
index 94e909ccc234aacff3d4d2cce9292c602a75f910..e7df93fe37ef1ff75d589597c84254fb4fb78125 100644 (file)
@@ -56,6 +56,9 @@
           wipe-workspace: true
 
     builders:
+      - shell:
+          !include-raw-escape:
+            - ../../build/cleanup
       - shell: "export NPROC=$(nproc); {ceph_build}"
       - shell:
           !include-raw: