2019-11-25 13:11:18 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2020-05-26 19:30:45 +02:00
|
|
|
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
2021-03-10 10:43:18 +01:00
|
|
|
source $current_dir/prints.sh
|
2020-05-26 19:30:45 +02:00
|
|
|
|
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_
|
2020-05-18 16:52:26 +02:00
|
|
|
|
2020-03-19 23:55:07 +01:00
|
|
|
ARCH="$(echo $CUSTOM_ENV_CI_RUNNER_EXECUTABLE_ARCH | cut -d'/' -f2)" # linux/amd64
|
2020-03-21 18:10:20 +01:00
|
|
|
DEFAULT_BRANCH="$CUSTOM_ENV_CI_DEFAULT_BRANCH"
|
2021-03-09 19:39:29 +01:00
|
|
|
|
|
|
|
CURRENT_BRANCH="$CUSTOM_ENV_CI_COMMIT_REF_NAME" # CUSTOM_ENV_CI_COMMIT_REF_NAME is the target branch of the MR
|
2023-05-22 11:43:12 +02:00
|
|
|
if [ -z "$CURRENT_BRANCH" ]
|
|
|
|
then
|
|
|
|
CURRENT_BRANCH="dev"
|
|
|
|
fi
|
|
|
|
|
2022-01-05 18:28:24 +01:00
|
|
|
LAST_CHANGELOG_ENTRY=$(curl https://gitlab.com/yunohost/yunohost/-/raw/$CURRENT_BRANCH/debian/changelog --silent | head -n 1) # yunohost (4.2) unstable; urgency=low
|
2021-03-09 19:39:29 +01:00
|
|
|
CURRENT_VERSION=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f3 | tr -d ';') # stable, testing, unstable
|
|
|
|
|
2023-05-16 12:14:15 +02:00
|
|
|
DEBIAN_VERSION_NUMBER=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f2 | tr -d '(' | tr -d ')' | cut -d'.' -f1) # 11, 12
|
2021-03-09 19:39:29 +01:00
|
|
|
|
|
|
|
declare -A DEBIAN_VERSION_TABLE
|
2023-05-16 12:14:15 +02:00
|
|
|
DEBIAN_VERSION_TABLE=(["11"]="bullseye" ["12"]="bookworm")
|
2021-03-09 19:39:29 +01:00
|
|
|
|
|
|
|
DEBIAN_VERSION="${DEBIAN_VERSION_TABLE[$DEBIAN_VERSION_NUMBER]}"
|
|
|
|
|
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
|
2020-05-19 16:19:08 +02:00
|
|
|
SNAPSHOT_NAME="after-install"
|
2019-12-23 06:11:29 +01:00
|
|
|
fi
|
|
|
|
PROJECT_DIR="$CUSTOM_ENV_CI_PROJECT_DIR"
|
2020-03-26 17:50:12 +01:00
|
|
|
PROJECT_NAME="$CUSTOM_ENV_CI_PROJECT_NAME"
|
|
|
|
|
2023-05-17 16:48:45 +02:00
|
|
|
PREFIX_IMAGE_NAME="ynh"
|
|
|
|
# For example ynh-buster
|
|
|
|
BASE_IMAGE="$PREFIX_IMAGE_NAME-$DEBIAN_VERSION"
|
2023-05-16 15:54:24 +02:00
|
|
|
|
2023-05-16 18:11:52 +02:00
|
|
|
CONTAINER_IMAGE="$BASE_IMAGE-r-$CUSTOM_ENV_CI_RUNNER_ID-p-$CUSTOM_ENV_CI_PROJECT_ID-c-$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID"
|