From 1c159d8f34c651732661287f43fcd4de226c186a Mon Sep 17 00:00:00 2001 From: tmcguinness Date: Tue, 24 Sep 2024 20:28:29 +0000 Subject: [PATCH] added a cleanup_experment funciton to ci_utils that cleans local archrive files --- ci/Jenkinsfile | 1 + ci/scripts/check_ci.sh | 1 + ci/scripts/utils/ci_utils.sh | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index 2654adba29..66ab489aa5 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -218,6 +218,7 @@ pipeline { sh(script: " rm -f ${error_file}") try { sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} ${system}") + sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh clean_experiment ${CUSTOM_WORKSPACE}/RUNTESTS/EXPDIR/${pslot}") } catch (Exception error_experment) { sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cancel_batch_jobs ${pslot}") ws(CUSTOM_WORKSPACE) { diff --git a/ci/scripts/check_ci.sh b/ci/scripts/check_ci.sh index 825d8f5e8b..710a4492de 100755 --- a/ci/scripts/check_ci.sh +++ b/ci/scripts/check_ci.sh @@ -168,6 +168,7 @@ for pr in ${pr_list}; do fi if [[ "${rocoto_state}" == "DONE" ]]; then #Remove Experment cases that completed successfully + "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh" cleanup_experiment "${pslot_dir}" rm -Rf "${pslot_dir}" rm -Rf "${pr_dir}/RUNTESTS/COMROOT/${pslot}" rm -f "${output_ci_single}" diff --git a/ci/scripts/utils/ci_utils.sh b/ci/scripts/utils/ci_utils.sh index 2a51467d38..4c56c84876 100755 --- a/ci/scripts/utils/ci_utils.sh +++ b/ci/scripts/utils/ci_utils.sh @@ -155,3 +155,16 @@ function publish_logs() { fi echo "${URL}" } + +function cleanup_experiment() { + # cleanup_experiment function + # This function takes a directory path of an EXPDIR and + # gets HOMEDIR value from config.base to + # clean up the archived files on disk. + + local PSLOT_PATH="$1" + local pslot=$(basename "${PSLOT_PATH}") + local HOMEDIR=$(grep 'export HOMEDIR=' "${PSLOT_PATH}/config.base" | cut -d'=' -f2 | tr -d '[:space:]') + local ARCHIVEDIR="${HOMEDIR}/archive" + rm -rf "${ARCHIVEDIR}/${pslot}" + \ No newline at end of file