From d3aafec77f781cf1d017af8308f1db450132d445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 5 Jul 2022 11:13:47 +0200 Subject: [PATCH] Fix OS detection in custom-docker-build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- scripts/lib/custom-docker-build | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/lib/custom-docker-build b/scripts/lib/custom-docker-build index 1c8292d..9a003cc 100755 --- a/scripts/lib/custom-docker-build +++ b/scripts/lib/custom-docker-build @@ -13,6 +13,16 @@ function get_base_image_reference() { fi } +function print_os_args() { + CUSTOM_BASE_IMAGE=get_base_image_reference "$1" + + if [ -z "$CUSTOM_BASE_IMAGE" ]; then + CUSTOM_BASE_IMAGE="$CUSTOM_DOCKER_ARCH/debian:buster" + fi + + printf -- "--build-arg CUSTOM_BASE_IMAGE=%s " "$CUSTOM_BASE_IMAGE" +} + function print_golang_args() { declare -A GOLANG_DOWNLOAD_SHA256 @@ -334,7 +344,7 @@ function parse_arguments() { version="${!tool}" case "$tool" in ARCH) CUSTOM_DOCKER_ARCH=$version ;; - OS) CUSTOM_BASE_IMAGE=get_base_image_reference $version ;; + OS) print_os_args $version ;; RUBY) print_ruby_args $version ;; BUNDLER) print_bundler_args $version ;; RUBYGEMS) print_rubygems_args $version ;; @@ -357,12 +367,6 @@ function parse_arguments() { esac fi done - - if [ -z "$CUSTOM_BASE_IMAGE" ]; then - CUSTOM_BASE_IMAGE="$CUSTOM_DOCKER_ARCH/debian:buster" - fi - - printf -- "--build-arg CUSTOM_BASE_IMAGE=%s " "$CUSTOM_BASE_IMAGE" } function generate_command() {