2019-11-25 13:11:18 +01:00
#!/usr/bin/env bash
2020-03-19 23:56:23 +01:00
# All Variables here: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference, strating with CUSTOM_ENV_
2019-11-25 13:11:18 +01:00
#CUSTOM_ENV_CI_DEFAULT_BRANCH=stretch-unstable
#CUSTOM_ENV_CI_JOB_NAME=build1
#CUSTOM_ENV_CI_BUILD_STAGE=pre-postinstall
#CUSTOM_ENV_CI_JOB_STAGE=pre-postinstall
#CUSTOM_ENV_CI_BUILD_NAME=build1
#CUSTOM_ENV_CI_PROJECT_TITLE=yunohost
#CUSTOM_ENV_CI_RUNNER_EXECUTABLE_ARCH=linux/amd64
#CUSTOM_ENV_CI_PROJECT_NAMESPACE=yunohost
#CUSTOM_ENV_CI_COMMIT_REF_NAME=stretch-unstable
2020-03-19 23:55:07 +01:00
#CUSTOM_ENV_CI_COMMIT_REF_SLUG=stretch-unstable
2019-11-25 13:11:18 +01:00
#CUSTOM_ENV_CI_PROJECT_NAME=yunohost
#CUSTOM_ENV_CI_PROJECT_DIR=/builds/yunohost/yunohost
2019-11-26 14:01:29 +01:00
CONTAINER_ID = " runner- $CUSTOM_ENV_CI_RUNNER_ID -project- $CUSTOM_ENV_CI_PROJECT_ID -concurrent- $CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID - $CUSTOM_ENV_CI_JOB_ID "
2020-03-19 23:55:07 +01:00
ARCH = " $( echo $CUSTOM_ENV_CI_RUNNER_EXECUTABLE_ARCH | cut -d'/' -f2) " # linux/amd64
DEFAULT_BRANCH = $( echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f1) # stretch-unstable, buster-unstable...
2020-03-20 00:55:43 +01:00
CURRENT_VERSION = $( echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f2) # stretch-unstable, stretch-testing, stretch-stable...
2020-03-19 23:55:07 +01:00
CURRENT_BRANCH = " $CUSTOM_ENV_CI_COMMIT_REF_NAME "
DEBIAN_VERSION = $( echo $CUSTOM_ENV_CI_COMMIT_REF_NAME | cut -d'-' -f1) # CUSTOM_ENV_CI_COMMIT_REF_NAME is the target branch of the MR: stretch-unstable, buster-unstable...
if [ -z " $DEBIAN_VERSION " ] || [ " $DEBIAN_VERSION " != "stretch" ] && [ " $DEBIAN_VERSION " != "buster" ]
2019-11-26 14:01:29 +01:00
then
2020-03-19 23:55:07 +01:00
echo " Use the default branch $DEFAULT_BRANCH "
DEBIAN_VERSION = " $DEFAULT_BRANCH "
2019-11-26 14:01:29 +01:00
fi
2020-03-19 23:55:07 +01:00
SNAPSHOT_NAME = " $CUSTOM_ENV_CI_JOB_IMAGE "
2019-11-25 13:11:18 +01:00
if [ -z " $SNAPSHOT_NAME " ]
then
SNAPSHOT_NAME = "after-postinstall"
2019-12-23 06:11:29 +01:00
fi
PROJECT_DIR = " $CUSTOM_ENV_CI_PROJECT_DIR "
PROJECT_NAME = " $CUSTOM_ENV_CI_PROJECT_NAME "