Commit 8cb95d80 authored by Emeric Verschuur's avatar Emeric Verschuur

Variable rename: CITBX_JOB_RUN_FILE_NAME => CITBX_JOB_FILE_NAME

parent 132eb197
......@@ -82,7 +82,7 @@ job-test-services-postgres:
image: registry.gitlab.com/ercom/docker-images/fpm:1.10.0-ubuntu-16.04
stage: build
variables:
CITBX_JOB_RUN_FILE_NAME: build-package.sh
CITBX_JOB_FILE_NAME: build-package.sh
tags:
- docker
script:
......@@ -127,7 +127,7 @@ build-package-rel-rpm: *build-package-rel
.test-package-template: &test-package-template
stage: test
variables:
CITBX_JOB_RUN_FILE_NAME: test-package.sh
CITBX_JOB_FILE_NAME: test-package.sh
tags: ["docker"]
script: ["ci-scripts/run-job-script.sh"]
......
......@@ -52,9 +52,9 @@ citbx_job_finish() {
}
# Load job
CITBX_JOB_RUN_FILE_NAME=${CITBX_JOB_RUN_FILE_NAME:-"$CI_JOB_NAME.sh"}
CITBX_JOB_FILE_NAME=${CITBX_JOB_FILE_NAME:-"$CI_JOB_NAME.sh"}
module_handler_list="before after"
CITBX_JOB_RUN_FILE_PATH="$CITBX_JOBS_DIR/${CITBX_JOB_RUN_FILE_NAME}"
CITBX_JOB_RUN_FILE_PATH="$CITBX_JOBS_DIR/${CITBX_JOB_FILE_NAME}"
if [ ! -f "$CITBX_JOB_RUN_FILE_PATH" ]; then
print_critical "Job definition file $CITBX_JOB_RUN_FILE_PATH not found"
fi
......
......@@ -156,6 +156,9 @@ gitlab_ci_variables() {
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
......@@ -208,6 +211,8 @@ citbx_run_ext_job() {
set -e
unset CITBX
unset CITBX_COMMAND
unset CITBX_JOB_FILE_NAME
# NOTE: Assure backward compatibility (old name for CITBX_JOB_FILE_NAME property)
unset CITBX_JOB_RUN_FILE_NAME
unset CITBX_GIT_CLEAN
bashopts_export_opts
......@@ -358,7 +363,6 @@ $(for j in "${CITBX_JOB_LIST[@]}"; do echo " $j"; done | sort -u)"
print_critical "Unreconized command '$command'; type '$CITBX_TOOL_NAME help' to display the help"
fi
CI_JOB_NAME=$command
CITBX_JOB_RUN_FILE_NAME=${CITBX_JOB_RUN_FILE_NAME:-"$CI_JOB_NAME.sh"}
# Read Image property
for p in '."'"$CI_JOB_NAME"'"' ''; do
case "$(gitlab_ci_query -r "$p.image | type")" in
......@@ -384,6 +388,8 @@ $(for j in "${CITBX_JOB_LIST[@]}"; do echo " $j"; done | sort -u)"
# Read the gitlab-ci variables
gitlab_ci_variables ".\"variables\"" || true
gitlab_ci_variables ".\"$CI_JOB_NAME\".\"variables\"" || true
# NOTE: Assure backward compatibility (old name for CITBX_JOB_FILE_NAME property)
CITBX_JOB_FILE_NAME=${CITBX_JOB_FILE_NAME:-${CITBX_JOB_RUN_FILE_NAME:-"$CI_JOB_NAME.sh"}}
# Define job usage
bashopts_tool_usage="$CITBX_TOOL_NAME '${command//\'/\\\'}' [arguments...]
=> type '$CITBX_TOOL_NAME help' to display the global help"
......@@ -438,8 +444,8 @@ $(for j in "${CITBX_JOB_LIST[@]}"; do echo " $j"; done | sort -u)"
# Load job
module_handler_list="define setup"
if [ -f "$CITBX_JOBS_DIR/$CITBX_JOB_RUN_FILE_NAME" ]; then
. "$CITBX_JOBS_DIR/$CITBX_JOB_RUN_FILE_NAME"
if [ -f "$CITBX_JOBS_DIR/$CITBX_JOB_FILE_NAME" ]; then
. "$CITBX_JOBS_DIR/$CITBX_JOB_FILE_NAME"
citbx_register_handler "job" "define"
citbx_register_handler "job" "setup"
fi
......
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