2019-11-25 13:11:18 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-03-26 17:50:12 +01:00
|
|
|
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
2024-08-07 23:31:32 +02:00
|
|
|
source $current_dir/common.sh
|
2019-11-25 13:11:18 +01:00
|
|
|
|
2024-08-07 23:31:32 +02:00
|
|
|
# This script is called multiple times with different stage ($2) value
|
|
|
|
# This is documented in https://docs.gitlab.com/runner/executors/custom.html#run
|
|
|
|
JOB_STAGE=$2
|
|
|
|
if [[ "$JOB_STAGE" == "prepare_script" ]]
|
|
|
|
then
|
|
|
|
echo "CI OPEN: $CUSTOM_ENV_CI_OPEN_MERGE_REQUESTS / CI PIPELINE SOURCE: $CUSTOM_ENV_CI_PIPELINE_SOURCE / REF NAME: $CUSTOM_ENV_CI_COMMIT_REF_NAME / COMMIT: $CUSTOM_ENV_CI_COMMIT_BRANCH, TAG: $CUSTOM_ENV_CI_COMMIT_TAG"
|
|
|
|
fi
|
|
|
|
|
|
|
|
###############################################################################
|
2019-11-25 13:11:18 +01:00
|
|
|
|
2024-08-07 23:31:32 +02:00
|
|
|
# This is the real 'important' logic bit
|
|
|
|
incus exec "$CONTAINER_NAME" /bin/bash < "${1}"
|
2019-11-25 13:11:18 +01:00
|
|
|
|
2024-08-07 23:31:32 +02:00
|
|
|
###############################################################################
|
2024-03-10 20:48:39 +01:00
|
|
|
err=$?
|
|
|
|
if [ $err -ne 0 ]; then
|
|
|
|
echo "Exit with error code $err"
|
2019-11-25 13:11:18 +01:00
|
|
|
# Exit using the variable, to make the build as failure in GitLab
|
|
|
|
# CI.
|
|
|
|
exit $BUILD_FAILURE_EXIT_CODE
|
2021-07-01 02:15:44 +02:00
|
|
|
fi
|