From 88bd0f6c7e0b6fc95839cb022f6e472de1bd7ea8 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 26 May 2020 19:24:01 +0200 Subject: [PATCH] use echo helpers --- base.sh | 2 +- cleanup.sh | 2 +- prepare.sh | 6 +++--- utils.sh | 7 ------- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/base.sh b/base.sh index bf6f3ed..f8a91f6 100755 --- a/base.sh +++ b/base.sh @@ -11,7 +11,7 @@ DEBIAN_VERSION=$(echo $CUSTOM_ENV_CI_COMMIT_REF_NAME | cut -d'-' -f1) # CUSTOM_E if [ -z "$DEBIAN_VERSION" ] || [ "$DEBIAN_VERSION" != "stretch" ] && [ "$DEBIAN_VERSION" != "buster" ] then DEBIAN_VERSION="$(echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f1)" # stretch-unstable, buster-unstable... - echo "Use the default debian version: $DEBIAN_VERSION" + info "Use the default debian version: $DEBIAN_VERSION" fi SNAPSHOT_NAME="$CUSTOM_ENV_CI_JOB_IMAGE" if [ -z "$SNAPSHOT_NAME" ] diff --git a/cleanup.sh b/cleanup.sh index 0eaf410..a855171 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -3,6 +3,6 @@ current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source $current_dir/base.sh # Get variables from base. -echo "Deleting container $CONTAINER_ID" +info "Deleting container $CONTAINER_ID" lxc delete -f "$CONTAINER_ID" \ No newline at end of file diff --git a/prepare.sh b/prepare.sh index 0f61bd4..dae0c91 100755 --- a/prepare.sh +++ b/prepare.sh @@ -11,13 +11,13 @@ trap "exit $SYSTEM_FAILURE_EXIT_CODE" ERR start_container () { if lxc info "$CONTAINER_ID" >/dev/null 2>/dev/null ; then - echo 'Found old container, deleting' + warn 'Found old container, deleting' lxc delete -f "$CONTAINER_ID" fi if ! lxc image info "$BASE_IMAGE-$SNAPSHOT_NAME" &>/dev/null then - echo "$BASE_IMAGE not found, please rebuild with rebuild_all.sh" + error "$BASE_IMAGE not found, please rebuild with rebuild_all.sh" # Inform GitLab Runner that this is a system failure, so it # should be retried. exit $SYSTEM_FAILURE_EXIT_CODE @@ -33,6 +33,6 @@ start_container () { wait_container $CONTAINER_ID } -echo "Running in $CONTAINER_ID" +info "Running in $CONTAINER_ID" start_container diff --git a/utils.sh b/utils.sh index ed54b47..348945e 100755 --- a/utils.sh +++ b/utils.sh @@ -39,13 +39,6 @@ function error() echo "[${BOLD}${RED}FAIL${NORMAL}] ${msg}" 2>&1 } -function critical() -{ - local msg=${1} - echo "[${BOLD}${RED}CRIT${NORMAL}] ${msg}" 2>&1 - exit 1 -} - clean_containers() { local base_image_to_clean=$1