diff --git a/README.md b/README.md index c9e00991..5035e849 100644 --- a/README.md +++ b/README.md @@ -419,7 +419,7 @@ A complete list of supported parameters for the `runs download` command is avail This command will reset a running test in the Ecosystem that is either stuck in a timeout condition or looping, by requeing the test. Note: The reset command does not wait for the server to complete the act of resetting the test, but if the command succeeds, then the server has accepted the request to reset the test. -## Example +### Example The run "C1234" can be reset using the following command: @@ -434,7 +434,7 @@ If after running `runs reset` the test is still not able to run through successf This command will cancel a running test in the Ecosystem. It will not delete any information that is already stored in the RAS about the test, it will only cancel the execution of the test. Note: The cancel command does not wait for the server to complete the act of cancelling the test, but if the command succeeds, then the server has accepted the request to cancel the test. -## Example +### Example The run "C1234" can be cancelled using the following command: @@ -442,6 +442,17 @@ The run "C1234" can be cancelled using the following command: galasactl runs cancel --name C1234 ``` +## Runs delete +This command can delete test runs. Currently it can delete only one test run at a time. +But this command can be used in conjunction with the `galasactl runs get` command to first query the names of the runs you wish to delete, then delete them all. + +### Example +``` +galasactl runs delete --name C1234 +``` + +Furthermore an example script demonstrates how old runs might be cleaned-out from your Result Archive Store (RAS), to reduce the size of the store and free up some space that can be used for more recent runs. +See [here](./test-scripts/runs-delete-too-old.sh) ## properties get This command retrieves details of properties in a namespace. diff --git a/test-scripts/runs-delete-too-old.sh b/test-scripts/runs-delete-too-old.sh new file mode 100755 index 00000000..17b23690 --- /dev/null +++ b/test-scripts/runs-delete-too-old.sh @@ -0,0 +1,59 @@ +#! /usr/bin/env bash + +# Where is this script executing from ? +BASEDIR=$(dirname "$0");pushd $BASEDIR 2>&1 >> /dev/null ;BASEDIR=$(pwd);popd 2>&1 >> /dev/null +# echo "Running from directory ${BASEDIR}" +export ORIGINAL_DIR=$(pwd) +cd "${BASEDIR}" + +#----------------------------------------------------------------------------------------- +# +# Set Colors +# +#----------------------------------------------------------------------------------------- +bold=$(tput bold) +underline=$(tput sgr 0 1) +reset=$(tput sgr0) +red=$(tput setaf 1) +green=$(tput setaf 76) +white=$(tput setaf 7) +tan=$(tput setaf 202) +blue=$(tput setaf 25) + +#----------------------------------------------------------------------------------------- +# +# Headers and Logging +# +#----------------------------------------------------------------------------------------- +underline() { printf "${underline}${bold}%s${reset}\n" "$@" ;} +h1() { printf "\n${underline}${bold}${blue}%s${reset}\n" "$@" ;} +h2() { printf "\n${underline}${bold}${white}%s${reset}\n" "$@" ;} +debug() { printf "${white}%s${reset}\n" "$@" ;} +info() { printf "${white}➜ %s${reset}\n" "$@" ;} +success() { printf "${green}✔ %s${reset}\n" "$@" ;} +error() { printf "${red}✖ %s${reset}\n" "$@" ;} +warn() { printf "${tan}➜ %s${reset}\n" "$@" ;} +bold() { printf "${bold}%s${reset}\n" "$@" ;} +note() { printf "\n${underline}${bold}${blue}Note:${reset} ${blue}%s${reset}\n" "$@" ;} + +h2 "Querying the RAS for old records we don't want any longer." +mkdir -p $BASEDIR/temp +cd $BASEDIR/temp >> /dev/null + +set -o pipefail + +galasactl runs get --age 120d:90d --format raw | cut -f1 -d'|' | sort | uniq > files-to-delete.txt +rc=$? ; if [[ "${rc}" != "0" ]]; then error "Failed to query the test runs to delete." ; exit 1 ; fi +success "Queried the run records we want to delete." + +h2 "Deleting the run records we don't care about." +while IFS="" read -r line +do + testRunName="$line" + info "Deleting test run $testRunName" + galasactl runs delete --name $testRunName + rc=$? ; if [[ "${rc}" != "0" ]]; then error "Failed to delete the test runs $testRunName" ; exit 1 ; fi + success "Deleted test run $testRunName" +done < files-to-delete.txt + +cd - >> /dev/null \ No newline at end of file