ligo/scripts/distribution/generic/parameters.sh

32 lines
1.3 KiB
Bash

# This script accepts three arguments, os family, os and it's version,
# which are subsequently used to fetch the respective docker
# image from the ocaml/infrastructure project.
#
# https://github.com/ocaml/infrastructure/wiki/Containers#selecting-linux-distributions
target_os_family=$1
target_os=$2
target_os_version=$3
# Variables configured at the CI level
dist="$LIGO_DIST_DIR"
version="$(echo $CI_JOB_ID)-$(echo $CI_COMMIT_SHORT_SHA)"
ci_job_id="$CI_JOB_ID"
# Image names for building & packaging
target="$target_os-$target_os_version"
tag_build="$LIGO_REGISTRY_IMAGE_BASE_NAME-build-$target:$version"
tag_package="$LIGO_REGISTRY_IMAGE_BASE_NAME-package-$target:$version"
tag_package_dockerized="$LIGO_REGISTRY_IMAGE_BASE_NAME-$target:$version"
# Check if there's a specific dockerfile override for
# the current target_os_family (e.g. debian-ish distros) or target_os (ubuntu, xubuntu, ...) and use it if there is one
target_os_family_specific_dockerfile="./docker/distribution/$target_os_family/$dockerfile_name.Dockerfile"
if test -f "$target_os_family_specific_dockerfile"; then
dockerfile="$target_os_family_specific_dockerfile"
fi
target_os_specific_dockerfile="./docker/distribution/$target_os_family/$target_os/$dockerfile_name.Dockerfile"
if test -f "$target_os_specific_dockerfile"; then
dockerfile="$target_os_specific_dockerfile"
fi