-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.bash
executable file
·32 lines (25 loc) · 989 Bytes
/
shared.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
set -a # Export all variables
PATH="$PATH:/usr/local/bin"
# Keep this file as lightweight as possible. It runs at the top of EVERY SINGLE SCRIPT.
# needed for local testing/running; gitlab makes these available in the runner
BUILD_FAILURE_EXIT_CODE=${BUILD_FAILURE_EXIT_CODE:-1}
RETRY_STEP_EXIT_CODE=${SYSTEM_FAILURE_EXIT_CODE:-2}
# Set debug output for scripts
CUSTOM_ENV_ANKA_ENABLE_JOB_DEBUG_LOGGING=${CUSTOM_ENV_ANKA_ENABLE_JOB_DEBUG_LOGGING:-false}
if $CUSTOM_ENV_ANKA_ENABLE_JOB_DEBUG_LOGGING; then
set -x
fi
########################
# FUNCTIONS
print_error () {
[[ -n "${2}" ]] && CALLING_FUNCTION_NAME="[${2}] "
echo -en "\033[91m${CALLING_FUNCTION_NAME}error: ${1}\033[0m\n" >&2
}
print_warning () {
[[ -n "${2}" ]] && CALLING_FUNCTION_NAME="[${2}] "
echo -en "\033[93m${CALLING_FUNCTION_NAME}warning: ${1}\033[0m\n" >&2
}
print_info () {
[[ -n "${2}" ]] && CALLING_FUNCTION_NAME="[${2}] "
echo -en "\033[94m${CALLING_FUNCTION_NAME}info: ${1}\033[0m\n" >&2
}