Skip to content

Commit

Permalink
added a cleanup_experment funciton to ci_utils that cleans local arch…
Browse files Browse the repository at this point in the history
…rive files
  • Loading branch information
tmcguinness committed Sep 24, 2024
1 parent ec63492 commit 1c159d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions ci/scripts/check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
13 changes: 13 additions & 0 deletions ci/scripts/utils/ci_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,16 @@ function publish_logs() {
fi
echo "${URL}"
}

function cleanup_experiment() {

Check notice

Code scanning / shellcheck

The mentioned syntax error was in this function. Note

The mentioned syntax error was in this function.

Check failure

Code scanning / shellcheck

Couldn't parse this brace group. Fix to allow more checks. Error

Couldn't parse this brace group. Fix to allow more checks.
# 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}"

Check failure

Code scanning / shellcheck

Expected a '}'. If you have one, try a ; or \n in front of it. Error

Expected a '}'. If you have one, try a ; or \n in front of it.

Check failure

Code scanning / shellcheck

Missing '}'. Fix any mentioned problems and try again. Error

Missing '}'. Fix any mentioned problems and try again.

0 comments on commit 1c159d8

Please sign in to comment.