Skip to content

Commit e00c234

Browse files
Fixed the test-build treatment of commq seperated versions and variants
1 parent f385ece commit e00c234

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test-build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ set -uo pipefail
66

77
. functions.sh
88

9+
# Convert comma delimited cli arguments to arrays
10+
# E.g. ./test-build.sh 4,6 slim,onbuild
11+
# "4,6" becomes "4 6" and "slim,onbuild" becomes "slim onbuild"
12+
IFS=',' read -ra versions_arg <<< "${1:-}"
13+
IFS=',' read -ra variant_arg <<< "${2:-}"
14+
915
function build () {
1016
local version
1117
local tag
@@ -37,7 +43,7 @@ function build () {
3743

3844
cd "$(cd "${0%/*}" && pwd -P)" || exit;
3945

40-
IFS=' ' read -ra versions <<< "$(IFS=','; get_versions . "$1")"
46+
IFS=' ' read -ra versions <<< "$(get_versions . "${versions_arg[@]}")"
4147
if [ ${#versions[@]} -eq 0 ]; then
4248
fatal "No valid versions found!"
4349
fi
@@ -51,8 +57,9 @@ for version in "${versions[@]}"; do
5157

5258
# Get supported variants according to the target architecture.
5359
# See details in function.sh
54-
IFS=' ' read -ra variants <<< "$(IFS=','; get_variants "$(dirname "$version")" "$2")"
60+
IFS=' ' read -ra variants <<< "$(get_variants "$(dirname "$version")" "${variant_arg[@]}")"
5561

62+
# Only build the default Dockerfile if "default" is in the variant list
5663
if [[ "${variants[*]}" =~ "default" ]]; then
5764
build "$version" "" "$tag"
5865
fi

0 commit comments

Comments
 (0)