1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-05 15:07:31 +00:00
kata-containers/tools/packaging/kata-debug/kata-debug-build-and-upload-payload.sh
Fabiano Fidêncio 38a7b5325f packaging/tools: Add kata-debug
kata-debug is a tool that is used as part of the Kata Containers CI to gather
information from the node, in order to help debugging issues with Kata
Containers.

As one can imagine, this can be expanded and used outside of the CI context,
and any contribution back to the script is very much welcome.

The resulting container is stored at the [Kata Containers quay.io
space](https://quay.io/repository/kata-containers/kata-debug) and can
be used as shown below:
```sh
kubectl debug $NODE_NAME -it --image=quay.io/kata-containers/kata-debug:latest
```

Fixes: 

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-07-21 14:05:30 +02:00

43 lines
794 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="`dirname ${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