use echo helpers

This commit is contained in:
Kay0u 2020-05-26 19:24:01 +02:00
parent aff9894e75
commit 88bd0f6c7e
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
4 changed files with 5 additions and 12 deletions

View file

@ -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" ]

View file

@ -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"

View file

@ -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

View file

@ -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