Allow to prefix deployed images into nested

This allows to escape the tag length limit of 128
and better organise images from different architectures
This commit is contained in:
Kamil Trzciński 2022-04-29 15:23:46 +02:00
parent 779a199009
commit ee1bb21ec9
3 changed files with 35 additions and 16 deletions

View file

@ -260,7 +260,7 @@ function parse_arguments() {
CUSTOM_IMAGE_NAME=debian
CUSTOM_IMAGE_VERSION=buster
for tool in "${TOOLS[@]}"; do
for tool in "${PATH_TOOLS[@]}" "${TAG_TOOLS[@]}"; do
if [ -n "${!tool}" ]; then
version="${!tool}"
case "$tool" in
@ -302,15 +302,16 @@ function generate_command() {
}
function build_custom_if_needed() {
build_image_name=$(get_image_name)
echo "Building image $build_image_name"
full_image_name="$CI_REGISTRY_IMAGE:$build_image_name"
build_image_path=$(get_image_path)
build_image_tag=$(get_image_tag)
echo "Building image $build_image_tag"
full_image_name="$build_image_path:$build_image_tag"
docker_command=$(generate_command $@ --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from="$full_image_name" -t "$full_image_name")
echo "Docker command:"
printf "\t%s" "$docker_command"
eval $docker_command
printf "\n\nSUCCESS - Successfully built:\n\t%s" "$build_image_name"
printf "\n\nSUCCESS - Successfully built:\n\t%s" "$build_image_tag"
}
build_custom_if_needed $@