From ce6134b0796f1acd6f6e70e1da608b983820e63e Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Tue, 20 Jun 2023 14:24:07 +0200 Subject: [PATCH 1/3] clean up local tmp if it has been saved to a tarball in the job's working directory --- bot/build.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bot/build.sh b/bot/build.sh index c8def2cdd3..dae3398214 100755 --- a/bot/build.sh +++ b/bot/build.sh @@ -196,4 +196,23 @@ echo " -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_PI ./eessi_container.sh "${COMMON_ARGS[@]}" "${TARBALL_STEP_ARGS[@]}" \ -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_PILOT_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr} +function check_tmp_tarball { + dir=$1 + ls ${dir} | grep -E 'tgz$|\.gz$' + return $? +} + +# clean storage used on local disk +if [[ -d ${STORAGE} ]]; then + # double-check that at least one tarball of the temporary storage was created + if check_tmp_tarball ${TARBALL_TMP_BUILD_STEP_DIR} || check_tmp_tarball ${TARBALL_TMP_TARBALL_STEP_DIR}; then + echo "Removing temporary storage under '${STORAGE}'" + # rm -rf ${STORAGE} + else + echo "Did not find any tarball containing the temporary storage for neither the" + echo "build nor the tar step. Hence, not removing the storage at '${STORAGE}'." +else + echo "Local disk storage at '${STORAGE}' not accessible, so wasn't cleaned up." +fi + exit 0 From d9b3eb6472a6972f957b160027b75a18333f15cf Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Tue, 20 Jun 2023 20:25:49 +0200 Subject: [PATCH 2/3] adding missing 'fi' --- bot/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bot/build.sh b/bot/build.sh index dae3398214..5728938c4a 100755 --- a/bot/build.sh +++ b/bot/build.sh @@ -211,6 +211,7 @@ if [[ -d ${STORAGE} ]]; then else echo "Did not find any tarball containing the temporary storage for neither the" echo "build nor the tar step. Hence, not removing the storage at '${STORAGE}'." + fi else echo "Local disk storage at '${STORAGE}' not accessible, so wasn't cleaned up." fi From e570f64f160e306054715b6fc787d68a2634fa02 Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Thu, 22 Jun 2023 18:51:26 +0200 Subject: [PATCH 3/3] do rm --- bot/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/build.sh b/bot/build.sh index 5728938c4a..025577a643 100755 --- a/bot/build.sh +++ b/bot/build.sh @@ -207,7 +207,7 @@ if [[ -d ${STORAGE} ]]; then # double-check that at least one tarball of the temporary storage was created if check_tmp_tarball ${TARBALL_TMP_BUILD_STEP_DIR} || check_tmp_tarball ${TARBALL_TMP_TARBALL_STEP_DIR}; then echo "Removing temporary storage under '${STORAGE}'" - # rm -rf ${STORAGE} + rm -rf ${STORAGE} else echo "Did not find any tarball containing the temporary storage for neither the" echo "build nor the tar step. Hence, not removing the storage at '${STORAGE}'."