2626
2727supported_arches=${ARCHES:- " linux/amd64" }
2828
29- arch_file_prefix=" ${script_dir} /../tags-architectures-"
3029arch_prefix=" linux/"
3130
3231# Get a list of comma-separated tags (e.g. latest,5d0da3dc9764-dev), return
@@ -40,8 +39,8 @@ function get_tag_string() {
4039
4140 # if we are building for a single arch, then also append this to the tag
4241 if [[ -n " ${arch:- } " ]] && [[ " ${arch:- } " != * ,* ]]; then
43- # strip the `linux/` from the docker buildx platform format
44- arch_suffix=" -${arch# " linux/ " } "
42+ # strip the `linux/` from the docker buildx platform format in the tag
43+ arch_suffix=" -${arch# ${arch_prefix} } "
4544 fi
4645
4746 for tag in ${tags/ ,/ } ; do
@@ -75,54 +74,9 @@ function build_caa_payload_image() {
7574 popd
7675}
7776
78- function get_arch_specific_tag_string() {
79- local tags=" $1 "
80- local arch=" $2 "
81- local tag_string=" "
82-
83- for tag in ${tags/ ,/ } ; do
84- tag_string+=" -t ${registry} /${name} :${tag} -${arch} "
85- done
86-
87- echo " $tag_string "
88- }
89-
90- # accept one arch as --platform
91- function build_caa_payload_arch_specific() {
92- pushd " ${script_dir} /../../"
93-
94- arch=${supported_arches# " $arch_prefix " }
95-
96- echo " arch=" $arch >> " $arch_file_prefix$arch "
97-
98- local tag_string
99- local build_type=dev
100-
101- tag_string=" $( get_arch_specific_tag_string " $dev_tags " " ${arch} " ) "
102- if [[ " $release_build " == " true" ]]; then
103- tag_string=" $( get_arch_specific_tag_string " $release_tags " " ${arch} " ) "
104- build_type=release
105- fi
106-
107- docker buildx build --platform " ${supported_arches} " \
108- --build-arg RELEASE_BUILD=" ${release_build} " \
109- --build-arg BUILD_TYPE=" ${build_type} " \
110- --build-arg VERSION=" ${version} " \
111- --build-arg COMMIT=" ${commit} " \
112- --build-arg YQ_VERSION=" ${YQ_VERSION} " \
113- -f cloud-api-adaptor/Dockerfile \
114- ${tag_string} \
115- --push \
116- .
117- popd
118- }
119-
12077# Get the options
121- while getopts " :ai " option; do
78+ while getopts " :i " option; do
12279 case $option in
123- a) # image arch specific
124- build_caa_payload_arch_specific
125- exit ;;
12680 i) # image
12781 build_caa_payload_image
12882 exit ;;
0 commit comments