Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-api-adaptor: Support podman in Build.sh #1798

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions src/cloud-api-adaptor/hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,35 @@ 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 push_all_tags() {
local tag_string="$1"
for tag in ${tag_string}; do
echo "Pushing ${tag}"
docker push ${tag};
done
}

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

local tag_string
local build_type=dev

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

echo "Single-platform build of caa payload image and loading the result to docker images"
docker buildx build --platform "${supported_arches}" \
--build-arg RELEASE_BUILD="${release_build}" \
--build-arg BUILD_TYPE="${build_type}" \
Expand All @@ -60,9 +82,13 @@ 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 \
.

echo "Push single-platform image to registry"
push_all_tags ${tag_string}

popd
}

Expand All @@ -72,7 +98,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,7 +122,9 @@ 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")"

echo "Multi-platform build of caa payload image and pushing the result to registry"
docker buildx build --platform "${supported_arches}" \
--build-arg RELEASE_BUILD="${release_build}" \
--build-arg BUILD_TYPE="${build_type}" \
Expand All @@ -105,9 +133,10 @@ 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} \
${tag_string_with_tflags} \
--push \
.

popd
}

Expand Down
Loading