diff --git a/task/buildah/0.2/buildah.yaml b/task/buildah/0.2/buildah.yaml index aefbf3757e..67a9070e37 100644 --- a/task/buildah/0.2/buildah.yaml +++ b/task/buildah/0.2/buildah.yaml @@ -182,6 +182,15 @@ spec: update-ca-trust fi + # If a platform is specified, ensure that the image tag is mapped to this platform + # to reduce the likelihood of accidentally stepping on other images being built. + export ARCH=$(echo `uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`) + if [ -n "${PLATFORM}" ]; then + if [ "${IMAGE##*-}" -neq "$ARCH" ]; then + export IMAGE="${IMAGE}-${ARCH}" + fi + fi + SOURCE_CODE_DIR=source if [ -e "$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE" ]; then dockerfile_path="$(pwd)/$SOURCE_CODE_DIR/$CONTEXT/$DOCKERFILE"