From 92247f72e8312be59a92321420d7b701c41ea5a4 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Fri, 9 Feb 2018 17:17:29 +0100
Subject: [PATCH] clean-up after builds so that the cache does not grow and
 left-over builds take less space

---
 gitlab/build.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/gitlab/build.sh b/gitlab/build.sh
index ef92a4d..1e2b3fe 100755
--- a/gitlab/build.sh
+++ b/gitlab/build.sh
@@ -24,3 +24,14 @@ export_env BOB_BUILD_NUMBER
 run_cmd cp ./ci/recipe_append.yaml conda/recipe_append.yaml
 
 run_cmd ${CONDA_ROOT}/bin/conda build --no-anaconda-upload --variant-config-files _ci/conda_build_config.yaml --python=${PYTHON_VERSION} conda
+
+# delete the bob packages from the cache otherwise the cache keeps increasing
+# over and over. See https://gitlab.idiap.ch/bob/bob.admin/issues/65
+run_cmd rm -rf ${CONDA_ROOT}/pkgs/bob*.tar.bz2
+
+# remove environments create by conda-build.
+run_cmd ${CONDA_ROOT}/bin/conda build purge
+
+# remove un-used cached conda packages (extracted directories in pkgs/) so that
+# builds take less space. This does not delete the tarballs.
+run_cmd ${CONDA_ROOT}/bin/conda clean --packages
-- 
GitLab