kata-containers/tools/packaging/kata-debug/kata-debug-build-and-upload-payload.sh
Shunsuke Kimura 5c156a24e8 kata-debug: Make path resolution more robust
Enabled to run from other scripts as source, etc.

Fixes: #11115

Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
2025-05-06 21:16:25 +09:00

43 lines
827 B
Bash
Executable File

#!/usr/bin/env bash
#
# Copyright 2023 Intel
#
# SPDX-License-Identifier: Apache-2.0
#
[ -z "${DEBUG}" ] || set -x
set -o errexit
set -o nounset
set -o pipefail
set -o errtrace
KATA_DEBUG_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
REGISTRY="${1:-"quay.io/kata-containers/kata-debug"}"
TAG="${2:-}"
arch=$(uname -m)
[ "$arch" = "x86_64" ] && arch="amd64"
IMAGE_TAG="${REGISTRY}:$(git rev-parse HEAD)-${arch}"
pushd ${KATA_DEBUG_DIR}
echo "Building the image"
docker build --tag ${IMAGE_TAG} .
echo "Pushing the image to the registry"
docker push ${IMAGE_TAG}
if [ -n "${TAG}" ]; then
ADDITIONAL_TAG="${REGISTRY}:${TAG}"
echo "Building the ${ADDITIONAL_TAG} image"
docker build --tag ${ADDITIONAL_TAG} .
echo "Pushing the image ${ADDITIONAL_TAG} to the registry"
docker push ${ADDITIONAL_TAG}
fi
popd