mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-23 23:00:19 +00:00
a4195b6e11
tickgit.com identifies `XXX` as label for TODO's. There is no need to list the `digest` hash examples in the TODO list, so replace the `XXX` and `YYY` examples with `XYZ` and `ZYX`. Signed-off-by: Niels de Vos <ndevos@ibm.com>
40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# shellcheck source=scripts/build_step.inc.sh
|
|
source "$(dirname "${0}")/build_step.inc.sh"
|
|
|
|
set -xe
|
|
# "docker manifest" requires experimental feature enabled
|
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
|
|
cd "$(dirname "${0}")/.."
|
|
|
|
# ceph base image used for building multi architecture images
|
|
build_env="build.env"
|
|
baseimg=$(awk -F = '/^BASE_IMAGE=/ {print $NF}' "${build_env}")
|
|
|
|
# get image digest per architecture
|
|
# {
|
|
# "arch": "amd64",
|
|
# "digest": "sha256:XYZ"
|
|
# }
|
|
# {
|
|
# "arch": "arm64",
|
|
# "digest": "sha256:ZYX"
|
|
# }
|
|
manifests=$(docker manifest inspect "${baseimg}" | jq '.manifests[] | {arch: .platform.architecture, digest: .digest}')
|
|
# qemu-user-static is to enable an execution of different multi-architecture containers by QEMU
|
|
# more info at https://github.com/multiarch/qemu-user-static
|
|
build_step "starting multiarch/qemu-user-static container"
|
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
# build and push per arch images
|
|
for ARCH in amd64 arm64; do
|
|
ifs=$IFS
|
|
IFS=
|
|
digest=$(awk -v ARCH=${ARCH} '{if (archfound) {print $NF; exit 0}}; {archfound=($0 ~ "arch.*"ARCH)}' <<<"${manifests}")
|
|
IFS=$ifs
|
|
base_img=${baseimg}@${digest}
|
|
build_step "make image-cephcsi for ${ARCH}"
|
|
GOARCH=${ARCH} BASE_IMAGE=${base_img} make image-cephcsi
|
|
done
|