Commit 786e63b7 authored by Stephane Bausseron's avatar Stephane Bausseron

Merge branch 'release-candidate-5.1' into 'master'

Release candidate 5.1

See merge request !28
parents e58d0b19 26b4d34e
Pipeline #24142766 passed with stages
in 4 minutes and 54 seconds
# CI toolbox for Gitlab - properties # CI toolbox for Gitlab - properties
# #
# To demand a minimal tool version
#CITBX_VERSION_REQ_MIN=5.1
#
# Scripts root directory # Scripts root directory
#CITBX_SCRIPTS_DIR=$CI_PROJECT_DIR/ci-scripts #CITBX_SCRIPTS_DIR=$CI_PROJECT_DIR/ci-scripts
# #
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
image: ubuntu:16.04 image: ubuntu:16.04
variables: variables:
GLOBALJOBVAR: "global variable" GLOBAL_TEST_VAR: "scope: global"
after_script: after_script:
- echo "job ${CI_JOB_NAME} end" - echo "job ${CI_JOB_NAME} end"
...@@ -34,10 +34,8 @@ job-advanced: ...@@ -34,10 +34,8 @@ job-advanced:
tags: tags:
- docker - docker
variables: variables:
JOBADVAR: "${CI_JOB_NAME} JOBADVAR value" JOB_TEST_VAR: "${CI_JOB_NAME} - ${GLOBAL_TEST_VAR}"
script: script:
- echo ${GLOBALJOBVAR}
- echo ${JOBADVAR}
- ci-scripts/run-job-script.sh - ci-scripts/run-job-script.sh
job-test-services-mysql: job-test-services-mysql:
...@@ -82,7 +80,7 @@ job-test-services-postgres: ...@@ -82,7 +80,7 @@ job-test-services-postgres:
image: registry.gitlab.com/ercom/docker-images/fpm:1.10.0-ubuntu-16.04 image: registry.gitlab.com/ercom/docker-images/fpm:1.10.0-ubuntu-16.04
stage: build stage: build
variables: variables:
CITBX_JOB_RUN_FILE_NAME: build-package.sh CITBX_JOB_FILE_NAME: build-package.sh
tags: tags:
- docker - docker
script: script:
...@@ -92,11 +90,13 @@ job-test-services-postgres: ...@@ -92,11 +90,13 @@ job-test-services-postgres:
except: except:
- tags - tags
- master - master
- experimental
.package-channel-rel: &package-channel-rel .package-channel-rel: &package-channel-rel
only: only:
- tags - tags
- master - master
- experimental
.build-package-dev: &build-package-dev .build-package-dev: &build-package-dev
<<: *build-package-template <<: *build-package-template
...@@ -125,7 +125,7 @@ build-package-rel-rpm: *build-package-rel ...@@ -125,7 +125,7 @@ build-package-rel-rpm: *build-package-rel
.test-package-template: &test-package-template .test-package-template: &test-package-template
stage: test stage: test
variables: variables:
CITBX_JOB_RUN_FILE_NAME: test-package.sh CITBX_JOB_FILE_NAME: test-package.sh
tags: ["docker"] tags: ["docker"]
script: ["ci-scripts/run-job-script.sh"] script: ["ci-scripts/run-job-script.sh"]
......
# Changelog # Changelog
## 5.1.0
* [CI] add experimental branch to the package release template
* [ci-scripts] Fix typo in a message display
* Variable rename: CITBX_JOB_RUN_FILE_NAME => CITBX_JOB_FILE_NAME
* [ci-toolbox] Improving the job variable management
* [ci-toolbox] Check if a service is started
* [job-advanced] Update job-advanced example job:
+ Remove citbx_run_ext_job call
+ Add test to check YAML variable scope
* [ci-toolbox] Use new command 'docker image ls' instead of legacy 'docker images' one
* [ci-toolbox] Remove useless check_tool_name function
* [ci-toolbox] Unset CITBX_RUN_SHELL in citbx_run_ext_job
* [ci-toolbox] Fix command check (job list part)
* [ci-toolbox] Replacing useless legacy CITBX_TOOL_NAME variable by the fixed 'ci-toolbox' value
* [ci-toolbox] Add citbx_ name prefix for several internal functions
* [ci-toolbox] Add a way to check minimal tool version for certain projects
## 5.0.0 ## 5.0.0
* [ci-toolbox] PATH environment variable propagation - Fix regression from the version 4.1.0 * [ci-toolbox] PATH environment variable propagation - Fix regression from the version 4.1.0
* Project split into two independent parts: ci-toolbox and run-job-script * Project split into two independent parts: ci-toolbox and run-job-script
......
...@@ -3,10 +3,10 @@ citbx_use "example" ...@@ -3,10 +3,10 @@ citbx_use "example"
job_define() { job_define() {
# You can: Define options: # You can: Define options:
bashopts_declare -n RUN_JOB_MINIMAL_BEFORE -l run-min-job \ bashopts_declare -n JOB_OPTION_LOCAL -l job-opt-local \
-d "Run minimal job before" -s -i -t boolean -d "Local job option not accessible from the docker" -s -i -t string -v "my local value"
bashopts_declare -n JOB_OPTION_EXPORT -l job-opt-export \ bashopts_declare -n JOB_OPTION_EXPORT -l job-opt-export \
-d "Local job option accissible from the docker" -s -i -t string -v "my exported value" -d "Job option accessible from the docker" -s -i -t string -v "my exported value"
bashopts_declare -n JOB_OPTION_EXIT_CODE -l job-exit-code \ bashopts_declare -n JOB_OPTION_EXIT_CODE -l job-exit-code \
-d "Job exit code" -i -t number -v "0" -d "Job exit code" -i -t number -v "0"
# Add JOB_OPTION_EXPORT to the export list # Add JOB_OPTION_EXPORT to the export list
...@@ -20,20 +20,19 @@ job_setup() { ...@@ -20,20 +20,19 @@ job_setup() {
" * on the host (outside the docker container)" \ " * on the host (outside the docker container)" \
" * before start the suitable docker container" " * before start the suitable docker container"
print_note "Outside the docker:" \ print_note "Outside the docker:" \
"* RUN_JOB_MINIMAL_BEFORE=\"$RUN_JOB_MINIMAL_BEFORE\"" \ "* JOB_OPTION_LOCAL=\"$JOB_OPTION_LOCAL\"" \
"* JOB_OPTION_EXPORT=\"$JOB_OPTION_EXPORT\"" "* JOB_OPTION_EXPORT=\"$JOB_OPTION_EXPORT\""
if [ "$RUN_JOB_MINIMAL_BEFORE" == "true" ]; then # Test variable scope
citbx_run_ext_job job-minimal test "$JOB_TEST_VAR" == "job-advanced - scope: global"
fi
} }
job_main() { job_main() {
print_info "This part is executed into the suitable docker container" print_info "This part is executed into the suitable docker container"
if [[ ! -v RUN_JOB_MINIMAL_BEFORE ]]; then if [[ ! -v JOB_OPTION_LOCAL ]]; then
print_info " [ OK ] RUN_JOB_MINIMAL_BEFORE=\"$RUN_JOB_MINIMAL_BEFORE\" (is not defined as expected)" print_info " [ OK ] JOB_OPTION_LOCAL=\"$JOB_OPTION_LOCAL\" (is not defined as expected)"
else else
print_critical " [ KO ] RUN_JOB_MINIMAL_BEFORE=\"$RUN_JOB_MINIMAL_BEFORE\" (is defined)" print_critical " [ KO ] JOB_OPTION_LOCAL=\"$JOB_OPTION_LOCAL\" (is defined)"
fi fi
if [[ -v JOB_OPTION_EXPORT ]]; then if [[ -v JOB_OPTION_EXPORT ]]; then
......
...@@ -52,9 +52,9 @@ citbx_job_finish() { ...@@ -52,9 +52,9 @@ citbx_job_finish() {
} }
# Load job # 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" 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 if [ ! -f "$CITBX_JOB_RUN_FILE_PATH" ]; then
print_critical "Job definition file $CITBX_JOB_RUN_FILE_PATH not found" print_critical "Job definition file $CITBX_JOB_RUN_FILE_PATH not found"
fi fi
...@@ -78,7 +78,7 @@ CITBX_JOB_START_TIME=$(date +%s) ...@@ -78,7 +78,7 @@ CITBX_JOB_START_TIME=$(date +%s)
trap citbx_job_finish EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGKILL SIGALRM SIGTERM trap citbx_job_finish EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGKILL SIGALRM SIGTERM
print_info "CI job begin" print_info "CI job begin"
if [ -z "$citbx_job_stage_main" ]; then if [ -z "$citbx_job_stage_main" ]; then
print_critical "Funtion job_main not found in the file $CITBX_JOB_RUN_FILE_PATH" print_critical "Function job_main not found in the file $CITBX_JOB_RUN_FILE_PATH"
fi fi
for hook in $citbx_job_stage_main; do for hook in $citbx_job_stage_main; do
$citbx_before_script $citbx_before_script
......
This diff is collapsed.
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