Skip to content

Commit

Permalink
cloud-api-adaptor: Support podman in Build.sh
Browse files Browse the repository at this point in the history
Update build.sh to support podman
podman does not support the --push flag

Signed-off-by: David Hadas <[email protected]>
  • Loading branch information
davidhadas committed Apr 15, 2024
1 parent d73a884 commit 9934e1e
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions src/cloud-api-adaptor/hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,24 @@ function get_tag_string() {
local tag_string=""

for tag in ${tags/,/ };do
tag_string+=" -t ${registry}/${name}:${tag}"
tag_string+=" ${registry}/${name}:${tag}"
done

echo "$tag_string"
}

# Add -t to each item of the tag list
function add_tflags() {
local tag_string="$1"
local tag_string_with_tflags=""

for tag in ${tag_string}; do
tag_string_with_tflags+=" -t ${tag}"
done

echo "$tag_string_with_tflags"
}

function build_caa_payload_image() {
pushd "${script_dir}/../../"

Expand All @@ -51,6 +63,7 @@ function build_caa_payload_image() {
tag_string="$(get_tag_string "$release_tags")"
build_type=release
fi
tag_string_with_tflags="$(add_tflags "$tag_string")"

docker buildx build --platform "${supported_arches}" \
--build-arg RELEASE_BUILD="${release_build}" \
Expand All @@ -60,9 +73,15 @@ function build_caa_payload_image() {
--build-arg YQ_VERSION="${YQ_VERSION}" \
--build-arg YQ_CHECKSUM="${YQ_CHECKSUM}" \
-f cloud-api-adaptor/Dockerfile \
${tag_string} \
--push \
${tag_string_with_tflags} \
--load \
.

for tag in ${tag_string}; do
echo "Pushing ${tag}"
docker push ${tag};
done

popd
}

Expand All @@ -72,7 +91,7 @@ function get_arch_specific_tag_string() {
local tag_string=""

for tag in ${tags/,/ };do
tag_string+=" -t ${registry}/${name}:${tag}-${arch}"
tag_string+=" ${registry}/${name}:${tag}-${arch}"
done

echo "$tag_string"
Expand All @@ -96,6 +115,7 @@ function build_caa_payload_arch_specific() {
tag_string="$(get_arch_specific_tag_string "$release_tags" "${arch}")"
build_type=release
fi
tag_string_with_tflags="$(add_tflags "$tag_string")"

docker buildx build --platform "${supported_arches}" \
--build-arg RELEASE_BUILD="${release_build}" \
Expand All @@ -105,9 +125,15 @@ function build_caa_payload_arch_specific() {
--build-arg YQ_VERSION="${YQ_VERSION}" \
--build-arg YQ_CHECKSUM="${YQ_CHECKSUM}" \
-f cloud-api-adaptor/Dockerfile \
${tag_string} \
--push \
${tag_string_with_tflags} \
--load \
.

for tag in ${tag_string}; do
echo "Pushing ${tag}"
docker push ${tag};
done

popd
}

Expand Down

0 comments on commit 9934e1e

Please sign in to comment.