Files
scylladb/tools/toolchain/prepare
Avi Kivity 957259fab7 tools: toolchain: prepare: adjust manifest manipulations
The manifest manipulation commands stopped working with podman 3;
the containers-storage: prefix now throws errors.

Switch to `buildah manifest`; since we're building with buildah,
we might as well maintain the manifest with buildah as well.

Closes #8231
2021-03-23 09:18:19 +02:00

45 lines
1.1 KiB
Bash
Executable File

#!/bin/bash -e
bv=$(buildah --version)
if (( $? != 0 )); then
echo install buildah 1.19.3 or later
exit 1
fi
# translate to array of version components
bv="${bv#buildah version }"
bv="${bv% (*}"
bv=(${bv//./ })
maj=${bv[0]}
min=${bv[1]}
patch=${bv[2]}
ok=$(( maj > 1 || ( maj == 1 && min > 19 ) || ( maj == 1 && min == 19 && patch >= 3 ) ))
if (( ! ok )); then
echo install buildah 1.19.3 or later
exit 1
fi
archs=(amd64 arm64 s390x)
if [[ ! -f /proc/sys/fs/binfmt_misc/qemu-aarch64 || ! -f /proc/sys/fs/binfmt_misc/qemu-s390x ]]; then
echo install qemu-user-static
exit 1
fi
buildah manifest create "$(<tools/toolchain/image)"
for arch in "${archs[@]}"; do
image_id_file="$(mktemp)"
buildah bud --arch="$arch" --no-cache --pull -f tools/toolchain/Dockerfile --iidfile "$image_id_file"
buildah manifest add --all "$(<tools/toolchain/image)" "$(<$image_id_file)"
rm "$image_id_file"
done
echo "Done building $(<tools/toolchain/image). You can now test it, and push with"
echo ""
echo " podman manifest push --all $(<tools/toolchain/image) docker://$(<tools/toolchain/image)"