Skip to content

Commit 9af5225

Browse files
Merge pull request #680 from LaurentGoderre/fix-679
Prevent the building of the default variant for each Travis stage
2 parents 7823eba + e00c234 commit 9af5225

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

test-build.sh

Lines changed: 13 additions & 4 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
@@ -49,11 +55,14 @@ for version in "${versions[@]}"; do
4955
tag=$(get_tag "$version")
5056
full_version=$(get_full_version "$version")
5157

52-
build "$version" "" "$tag"
53-
5458
# Get supported variants according to the target architecture.
5559
# See details in function.sh
56-
IFS=' ' read -ra variants <<< "$(IFS=','; get_variants "$(dirname "$version")" "$2")"
60+
IFS=' ' read -ra variants <<< "$(get_variants "$(dirname "$version")" "${variant_arg[@]}")"
61+
62+
# Only build the default Dockerfile if "default" is in the variant list
63+
if [[ "${variants[*]}" =~ "default" ]]; then
64+
build "$version" "" "$tag"
65+
fi
5766

5867
for variant in "${variants[@]}"; do
5968
# Skip non-docker directories

0 commit comments

Comments
 (0)