Commit 898ebdfa authored by Emeric Verschuur's avatar Emeric Verschuur

Improve messages/help formating

parent 60390b5b
...@@ -388,22 +388,26 @@ fi ...@@ -388,22 +388,26 @@ fi
if [ ${#CITBX_MISSING_PKGS[@]} -eq 0 ]; then if [ ${#CITBX_MISSING_PKGS[@]} -eq 0 ]; then
eval "$(citbx_job_list -f 'printf("CITBX_JOB_LIST+=(\"%s\");", $0);')" eval "$(citbx_job_list -f 'printf("CITBX_JOB_LIST+=(\"%s\");", $0);')"
fi fi
bashopts_setup -n "run.sh" \ bashopts_setup -n "run.sh" \
-d "Gitlab-CI job runner tool" \ -d "Gitlab-CI job runner tool" \
-s "$CITBX_RC_PATH" \ -s "$CITBX_RC_PATH"
-u "$0 command [command options] [arguments...]
=> type '$0 command -h' to display the contextual help
COMMANDS:
help : Display this help
setup : Setup the environment
update : Update this tool (fetch the last version from https://gitlab.com/ercom/citbx4gitlab)
<job name> from : ${CITBX_JOB_LIST[*]}"
command=$1 command=$1
shift || true shift || true
case "$command" in case "$command" in
''|h|help|-h|--help) ''|h|help|-h|--help)
bashopts_tool_usage="$0 command [command options] [arguments...]
=> type '$0 command -h' to display the contextual help
COMMANDS:
help : Display this help
setup : Setup the environment
update : Update this tool (fetch the last version from https://gitlab.com/ercom/citbx4gitlab)
... or a job from the job list
JOBS:
$(for j in "${CITBX_JOB_LIST[@]}"; do echo " $j"; done | sort -u)"
bashopts_diplay_help_delayed bashopts_diplay_help_delayed
;; ;;
setup) setup)
...@@ -585,7 +589,7 @@ gitlab_ci_script ".\"$CI_JOB_NAME\".\"before_script\"" \ ...@@ -585,7 +589,7 @@ gitlab_ci_script ".\"$CI_JOB_NAME\".\"before_script\"" \
|| gitlab_ci_script ".\"before_script\"" \ || gitlab_ci_script ".\"before_script\"" \
|| true || true
gitlab_ci_script ".\"$CI_JOB_NAME\".\"script\"" \ gitlab_ci_script ".\"$CI_JOB_NAME\".\"script\"" \
|| print_critical "script $CI_JOB_NAME.script node nor found!" || print_critical "script \"$CI_JOB_NAME\".script node nor found!"
for line in "${CITBX_YAML_SCRIPT_ELTS[@]}"; do for line in "${CITBX_YAML_SCRIPT_ELTS[@]}"; do
CITBX_JOB_SCRIPT="$CITBX_JOB_SCRIPT CITBX_JOB_SCRIPT="$CITBX_JOB_SCRIPT
print_cmd $(bashopts_get_def line) print_cmd $(bashopts_get_def line)
...@@ -675,7 +679,7 @@ done ...@@ -675,7 +679,7 @@ done
case "$CITBX_JOB_EXECUTOR" in case "$CITBX_JOB_EXECUTOR" in
shell) shell)
print_info "Running the job $CI_JOB_NAME into the shell $CITBX_JOB_SHELL..." print_info "Running the job \"$CI_JOB_NAME\" into the shell $CITBX_JOB_SHELL..."
( (
unset CITBX unset CITBX
export GITLAB_CI=true export GITLAB_CI=true
...@@ -688,7 +692,7 @@ case "$CITBX_JOB_EXECUTOR" in ...@@ -688,7 +692,7 @@ case "$CITBX_JOB_EXECUTOR" in
docker) docker)
# Setup docker environment # Setup docker environment
if [ -z "$CITBX_DOCKER_IMAGE" ] || [ "$CITBX_DOCKER_IMAGE" == "null" ]; then if [ -z "$CITBX_DOCKER_IMAGE" ] || [ "$CITBX_DOCKER_IMAGE" == "null" ]; then
print_critical "No image property found in .gitlab-ci.yml for the job $CI_JOB_NAME" print_critical "No image property found in .gitlab-ci.yml for the job \"$CI_JOB_NAME\""
fi fi
CITBX_ID=$(head -c 8 /dev/urandom | od -t x8 -An | grep -oE '\w+') CITBX_ID=$(head -c 8 /dev/urandom | od -t x8 -An | grep -oE '\w+')
CITBX_DOCKER_PREFIX="citbx-$CITBX_ID" CITBX_DOCKER_PREFIX="citbx-$CITBX_ID"
...@@ -838,7 +842,7 @@ case "$CITBX_JOB_EXECUTOR" in ...@@ -838,7 +842,7 @@ case "$CITBX_JOB_EXECUTOR" in
print_info "Running a shell into the $CITBX_DOCKER_IMAGE docker container..." print_info "Running a shell into the $CITBX_DOCKER_IMAGE docker container..."
CITBX_JOB_DOCKER_RUN_ARGS+=(-w "$PWD") CITBX_JOB_DOCKER_RUN_ARGS+=(-w "$PWD")
else else
print_info "Running the job $CI_JOB_NAME into the $CITBX_DOCKER_IMAGE docker container..." print_info "Running the job \"$CI_JOB_NAME\" into the $CITBX_DOCKER_IMAGE docker container..."
CITBX_JOB_DOCKER_RUN_ARGS+=(-w "$CI_PROJECT_DIR") CITBX_JOB_DOCKER_RUN_ARGS+=(-w "$CI_PROJECT_DIR")
fi 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