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 )"
|
2020-05-26 19:30:45 +02:00
|
|
|
source $current_dir/variables.sh # Get variables from variables.
|
2019-11-25 13:11:18 +01:00
|
|
|
|
|
|
|
case ${2} in
|
|
|
|
prepare_script)
|
2021-06-17 15:43:50 +02:00
|
|
|
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"
|
2019-11-25 13:11:18 +01:00
|
|
|
;;
|
|
|
|
get_sources)
|
|
|
|
;;
|
|
|
|
restore_cache)
|
|
|
|
;;
|
|
|
|
download_artifacts)
|
|
|
|
;;
|
2021-07-01 02:15:44 +02:00
|
|
|
# build_script is no step_script
|
|
|
|
# but we can also have "step_release" or "step_accessibility"
|
|
|
|
# More info here:
|
|
|
|
# https://docs.gitlab.com/runner/executors/custom.html#run
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/26426
|
|
|
|
step_*)
|
2019-11-25 13:11:18 +01:00
|
|
|
case $PROJECT_NAME in
|
|
|
|
yunohost)
|
2020-05-19 16:19:08 +02:00
|
|
|
# Nothing to do?
|
2019-11-25 13:11:18 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
after_script)
|
|
|
|
;;
|
|
|
|
archive_cache)
|
|
|
|
;;
|
|
|
|
upload_artifact_on_success)
|
|
|
|
;;
|
|
|
|
upload_artifact_on_failure)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
lxc exec "$CONTAINER_ID" /bin/bash < "${1}"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
# 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
|