From b8cd62b5d21831d939399822e5f5769a43c6814b Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Sun, 11 Feb 2018 12:14:25 +0100
Subject: [PATCH] move the clean process to after build

---
 gitlab/after_build.sh | 19 +++++++++++++++++++
 gitlab/build.sh       |  8 --------
 2 files changed, 19 insertions(+), 8 deletions(-)
 create mode 100755 gitlab/after_build.sh

diff --git a/gitlab/after_build.sh b/gitlab/after_build.sh
new file mode 100755
index 0000000..a568abe
--- /dev/null
+++ b/gitlab/after_build.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+source $(dirname ${0})/functions.sh
+
+# 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
+rm -rf ${CONDA_ROOT}/pkgs/bob*.tar.bz2
+
+# run git clean to clean everything that is not needed. This helps to keep the
+# disk usage on CI machines to minimum.
+git clean -ffdx \
+    --exclude="miniconda.sh" \
+    --exclude="miniconda/pkgs/*.tar.bz2" \
+    --exclude="miniconda/pkgs/urls.txt" \
+    --exclude="miniconda/conda-bld/linux-64/*.tar.bz2" \
+    --exclude="miniconda/conda-bld/osx-64/*.tar.bz2" \
+    --exclude="_ci" \
+    --exclude="dist/*.zip" \
+    --exclude="sphinx"
diff --git a/gitlab/build.sh b/gitlab/build.sh
index e1a1f8e..a654fd3 100755
--- a/gitlab/build.sh
+++ b/gitlab/build.sh
@@ -1,5 +1,4 @@
 #!/usr/bin/env bash
-# Wed 21 Sep 2016 13:08:05 CEST
 
 source $(dirname ${0})/functions.sh
 
@@ -24,10 +23,3 @@ 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
-
-# run git clean to clean everything that is not needed
-git clean -ffdx --exclude=miniconda.sh --exclude="miniconda/pkgs/*.tar.bz2" --exclude=miniconda/pkgs/urls.txt --exclude=_ci --exclude="miniconda/conda-bld/linux-64/*.tar.bz2" --exclude="miniconda/conda-bld/osx-64/*.tar.bz2" --exclude="dist/*.zip" --exclude=sphinx
-- 
GitLab