[Fix] Load config files first in pipeline script
This commit is contained in:
parent
9d56268c38
commit
d4c09e5c90
|
@ -132,6 +132,45 @@ main() (
|
||||||
fi
|
fi
|
||||||
pipeline="$1"
|
pipeline="$1"
|
||||||
|
|
||||||
|
# Load config file.
|
||||||
|
if [ ! -r "${config_file}" ]; then
|
||||||
|
fail "Config file '${config_file}' is not readable."
|
||||||
|
fi
|
||||||
|
# shellcheck source=./conf/netoik-cicd.conf.sample
|
||||||
|
source "${config_file}"
|
||||||
|
|
||||||
|
# Load errors file.
|
||||||
|
if [ ! -r "${errors_file}" ]; then
|
||||||
|
fail "Errors file '${errors_file}' is not reachable."
|
||||||
|
fi
|
||||||
|
# shellcheck source=./conf/errors.conf.sample
|
||||||
|
source "${errors_file}"
|
||||||
|
|
||||||
|
# Check variables in config file.
|
||||||
|
if [ -z "${runner_sock}" ]; then
|
||||||
|
fail "Variable runner_sock is empty." "${err_runner_sock_empty}"
|
||||||
|
fi
|
||||||
|
if [ ! -S "${runner_sock}" ]; then
|
||||||
|
fail "Sock runner_sock='${runner_sock}' does not exist." \
|
||||||
|
"${err_runner_sock_not_exist}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${runner_timeout}" ]; then
|
||||||
|
fail "Variable runner_timeout is empty." "${err_runner_timeout_empty}"
|
||||||
|
fi
|
||||||
|
if [ "${runner_timeout}" -lt 0 ]; then
|
||||||
|
fail "Runner timeout is not valid: ${runner_timeout}." \
|
||||||
|
"${err_runner_timeout_not_valid}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${git_runner_groupname}" ]; then
|
||||||
|
fail "Variable git_runner_groupname is empty." "${err_git_runner_groupname_empty}"
|
||||||
|
fi
|
||||||
|
if ! getent group "${git_runner_groupname}"; then
|
||||||
|
fail "Git-runner group '${git_runner_groupname}' does not exist." \
|
||||||
|
"${err_git_runner_group_not_exist}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Generate pipeline tmp sock.
|
# Generate pipeline tmp sock.
|
||||||
tsp="$(date +%s)"
|
tsp="$(date +%s)"
|
||||||
random="$(echo "${RANDOM}" | md5sum | head --bytes 32)"
|
random="$(echo "${RANDOM}" | md5sum | head --bytes 32)"
|
||||||
|
@ -181,45 +220,6 @@ main() (
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Load config file.
|
|
||||||
if [ ! -r "${config_file}" ]; then
|
|
||||||
fail "Config file '${config_file}' is not readable."
|
|
||||||
fi
|
|
||||||
# shellcheck source=./conf/netoik-cicd.conf.sample
|
|
||||||
source "${config_file}"
|
|
||||||
|
|
||||||
# Load errors file.
|
|
||||||
if [ ! -r "${errors_file}" ]; then
|
|
||||||
fail "Errors file '${errors_file}' is not reachable."
|
|
||||||
fi
|
|
||||||
# shellcheck source=./conf/errors.conf.sample
|
|
||||||
source "${errors_file}"
|
|
||||||
|
|
||||||
# Check variables in config file.
|
|
||||||
if [ -z "${runner_sock}" ]; then
|
|
||||||
fail "Variable runner_sock is empty." "${err_runner_sock_empty}"
|
|
||||||
fi
|
|
||||||
if [ ! -S "${runner_sock}" ]; then
|
|
||||||
fail "Sock runner_sock='${runner_sock}' does not exist." \
|
|
||||||
"${err_runner_sock_not_exist}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${runner_timeout}" ]; then
|
|
||||||
fail "Variable runner_timeout is empty." "${err_runner_timeout_empty}"
|
|
||||||
fi
|
|
||||||
if [ "${runner_timeout}" -lt 0 ]; then
|
|
||||||
fail "Runner timeout is not valid: ${runner_timeout}." \
|
|
||||||
"${err_runner_timeout_not_valid}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${git_runner_groupname}" ]; then
|
|
||||||
fail "Variable git_runner_groupname is empty." "${err_git_runner_groupname_empty}"
|
|
||||||
fi
|
|
||||||
if ! getent group "${git_runner_groupname}"; then
|
|
||||||
fail "Git-runner group '${git_runner_groupname}' does not exist." \
|
|
||||||
"${err_git_runner_group_not_exist}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Stop now if testing.
|
# Stop now if testing.
|
||||||
if "${testing}"; then
|
if "${testing}"; then
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue