yunohost-ci/variables.sh

33 lines
1.5 KiB
Bash
Raw Normal View History

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
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"
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
LAST_CHANGELOG_ENTRY=$(curl https://raw.githubusercontent.com/YunoHost/yunohost/$CURRENT_BRANCH/debian/changelog --silent | head -n 1) # yunohost (4.2) unstable; urgency=low
CURRENT_VERSION=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f3 | tr -d ';') # stable, testing, unstable
DEBIAN_VERSION_NUMBER=$(echo $LAST_CHANGELOG_ENTRY | cut -d' ' -f2 | tr -d '(' | tr -d ')' | cut -d'.' -f1) # 3, 4, 11
declare -A DEBIAN_VERSION_TABLE
DEBIAN_VERSION_TABLE=(["4"]="buster" ["11"]="bullseye")
DEBIAN_VERSION="${DEBIAN_VERSION_TABLE[$DEBIAN_VERSION_NUMBER]}"
SNAPSHOT_NAME="$CUSTOM_ENV_CI_JOB_IMAGE"
2019-11-25 13:11:18 +01:00
if [ -z "$SNAPSHOT_NAME" ]
then
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"
2020-08-01 21:17:14 +02:00
# For example yunohost-buster-unstable
2020-05-18 16:52:26 +02:00
BASE_IMAGE="yunohost-$DEBIAN_VERSION-$CURRENT_VERSION"