2 # This script guesses some environment variables based on the builder name and
3 # the current platform, to reduce the amount of variables defined in the CI
9 source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
11 # Load extra environment variables
12 vars="${EXTRA_VARIABLES-}"
13 echo "${vars}" | jq '' >/dev/null # Validate JSON and exit on errors
14 for key in $(echo "${vars}" | jq "keys[]" -r); do
15 # On Windows, for whatever reason, $key contains the BOM character in it,
16 # and that messes up `jq ".${key}"`. This line strips the BOM from the key.
18 # https://unix.stackexchange.com/a/381263
19 key="$(echo "${key}" | sed '1s/^\xEF\xBB\xBF//')"
21 echo "adding extra environment variable ${key}"
22 value="$(echo "${vars}" | jq ".${key}" -r)"
23 export "${key}"="${value}"
24 ciCommandSetEnv "${key}" "${value}"
27 # Builders starting with `dist-` are dist builders, but if they also end with
28 # `-alt` they are alternate dist builders.
29 if [[ "${CI_JOB_NAME}" = dist-* ]]; then
30 if [[ "${CI_JOB_NAME}" = *-alt ]]; then
31 echo "alternate dist builder detected, setting DEPLOY_ALT=1"
32 ciCommandSetEnv DEPLOY_ALT 1
34 echo "normal dist builder detected, setting DEPLOY=1"
35 ciCommandSetEnv DEPLOY 1
39 # All the Linux builds happen inside Docker.
41 if [[ -z "${IMAGE+x}" ]]; then
42 echo "linux builder detected, using docker to run the build"
43 ciCommandSetEnv IMAGE "${CI_JOB_NAME}"
45 echo "a custom docker image is already set"