Commit 640ae3c3 authored by Emeric Verschuur's avatar Emeric Verschuur

[ci-toolbox] Improving the job variable management

parent 8cb95d80
......@@ -134,7 +134,6 @@ citbx_job_list() {
| gawk 'match($0, /^'"$prefix"'(.*)$/, f) {'"$outcmd"'}'
}
declare -A CITBX_SHELL_ENV
# fetch YAML variables
gitlab_ci_variables() {
local node=$1
......@@ -155,15 +154,9 @@ gitlab_ci_variables() {
eval "$k=$(gitlab_ci_query "${node}.$k")"
declare | grep "^$k=" | sed -E 's/^[^=]+=//g'
)
case "$k" in
CITBX_JOB_RUN_FILE_NAME) # Old name for CITBX_JOB_FILE_NAME
eval "export CITBX_JOB_FILE_NAME=$value"
;;
CITBX_*|GIT_*|CI_*)
eval "export $k=$value"
esac
CITBX_SHELL_ENV[$k]=$value
CITBX_DOCKER_RUN_ARGS+=(-e "$k=$(eval echo "$value")")
eval "$k=$value"
CITBX_JOB_VARIABLE_LIST+=($k)
CITBX_DOCKER_RUN_ARGS+=(-e "$(eval "echo $k=$value")")
done
;;
*)
......@@ -658,8 +651,8 @@ case "$CITBX_JOB_EXECUTOR" in
for e in ${CITBX_ENV_EXPORT_LIST[@]}; do
export $e
done
for e in "${!CITBX_SHELL_ENV[@]}"; do
eval "export $e=${CITBX_SHELL_ENV[$e]}"
for e in "${CITBX_JOB_VARIABLE_LIST[@]}"; do
export $e
done
# Shell selector (like the gitlab-runner one) will try to find bash, otherwise sh
eval "$CITBX_SCRIPT_COMMON"'$SHELL -c '"$CITBX_JOB_SCRIPT"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment