mirror of
https://github.com/YunoHost/yunohost-ci.git
synced 2024-09-03 20:05:53 +02:00
use echo helpers
This commit is contained in:
parent
aff9894e75
commit
88bd0f6c7e
4 changed files with 5 additions and 12 deletions
2
base.sh
2
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" ]
|
if [ -z "$DEBIAN_VERSION" ] || [ "$DEBIAN_VERSION" != "stretch" ] && [ "$DEBIAN_VERSION" != "buster" ]
|
||||||
then
|
then
|
||||||
DEBIAN_VERSION="$(echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f1)" # stretch-unstable, buster-unstable...
|
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
|
fi
|
||||||
SNAPSHOT_NAME="$CUSTOM_ENV_CI_JOB_IMAGE"
|
SNAPSHOT_NAME="$CUSTOM_ENV_CI_JOB_IMAGE"
|
||||||
if [ -z "$SNAPSHOT_NAME" ]
|
if [ -z "$SNAPSHOT_NAME" ]
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
source $current_dir/base.sh # Get variables from base.
|
source $current_dir/base.sh # Get variables from base.
|
||||||
|
|
||||||
echo "Deleting container $CONTAINER_ID"
|
info "Deleting container $CONTAINER_ID"
|
||||||
|
|
||||||
lxc delete -f "$CONTAINER_ID"
|
lxc delete -f "$CONTAINER_ID"
|
|
@ -11,13 +11,13 @@ trap "exit $SYSTEM_FAILURE_EXIT_CODE" ERR
|
||||||
|
|
||||||
start_container () {
|
start_container () {
|
||||||
if lxc info "$CONTAINER_ID" >/dev/null 2>/dev/null ; then
|
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"
|
lxc delete -f "$CONTAINER_ID"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! lxc image info "$BASE_IMAGE-$SNAPSHOT_NAME" &>/dev/null
|
if ! lxc image info "$BASE_IMAGE-$SNAPSHOT_NAME" &>/dev/null
|
||||||
then
|
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
|
# Inform GitLab Runner that this is a system failure, so it
|
||||||
# should be retried.
|
# should be retried.
|
||||||
exit $SYSTEM_FAILURE_EXIT_CODE
|
exit $SYSTEM_FAILURE_EXIT_CODE
|
||||||
|
@ -33,6 +33,6 @@ start_container () {
|
||||||
wait_container $CONTAINER_ID
|
wait_container $CONTAINER_ID
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Running in $CONTAINER_ID"
|
info "Running in $CONTAINER_ID"
|
||||||
|
|
||||||
start_container
|
start_container
|
||||||
|
|
7
utils.sh
7
utils.sh
|
@ -39,13 +39,6 @@ function error()
|
||||||
echo "[${BOLD}${RED}FAIL${NORMAL}] ${msg}" 2>&1
|
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()
|
clean_containers()
|
||||||
{
|
{
|
||||||
local base_image_to_clean=$1
|
local base_image_to_clean=$1
|
||||||
|
|
Loading…
Add table
Reference in a new issue