gitlab-build-images/scripts/lib/custom-docker.sh
Kamil Trzciński ee1bb21ec9 Allow to prefix deployed images into nested
This allows to escape the tag length limit of 128
and better organise images from different architectures
2022-05-02 15:26:47 +02:00

29 lines
684 B
Bash

PATH_TOOLS=()
TAG_TOOLS=(DEBIAN RUBY BUNDLER GOLANG GIT LFS CHROME NODE YARN POSTGRESQL GRAPHICSMAGICK PGBOUNCER BAZELISK DOCKER GCLOUD KUBECTL)
function get_image_path() {
local path
path=""
for tool in "${PATH_TOOLS[@]}"; do
if [[ -n "${!tool}" ]]; then
path="${path}-${tool,,}-${!tool}"
fi
done
if [[ -n "$path" ]]; then
echo "$CI_REGISTRY_IMAGE/${path:1}"
else
echo "$CI_REGISTRY_IMAGE"
fi
}
function get_image_tag() {
local tag
tag=""
for tool in "${TAG_TOOLS[@]}"; do
if [[ -n "${!tool}" ]]; then
tag="${tag}-${tool,,}-${!tool}"
fi
done
echo "${tag:1}"
}