Files
kata-containers/tests/run_packages_testing.sh
Gabriela Cervantes 59f7678f94 tests: Remove performing updates in Fedora dockerfiles
For obs and running the packages testing in Fedora, we need to remove
the performing of doing an update as it is hit by
https://github.com/kata-containers/runtime/issues/2580. This is needed
to unblock the errors in the testing.

Fixes #1001

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2020-04-06 12:07:11 -05:00

62 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright (c) 2020 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
http_proxy="${http_proxy:-}"
https_proxy="${https_proxy:-}"
DOCKERFILE_PATH="${SCRIPT_PATH}/Dockerfile"
OS_DISTRIBUTION="${OS_DISTRIBUTION:-fedora:31}"
install_packages() {
echo "Test distribution packages for ${OS_DISTRIBUTION}"
run_test
remove_image_and_dockerfile
}
run_test() {
generate_dockerfile
build_dockerfile
}
generate_dockerfile() {
UPDATE="dnf -y update"
DEPENDENCIES="dnf install -y curl git make sudo golang dnf-plugin-config-manager"
echo "Building dockerfile for ${OS_DISTRIBUTION}"
sed \
-e "s|@OS_DISTRIBUTION@|${OS_DISTRIBUTION}|g" \
-e "s|@DEPENDENCIES@|${DEPENDENCIES}|g" \
"${DOCKERFILE_PATH}/FedoraDockerfile.in" > "${DOCKERFILE_PATH}"/Dockerfile
}
build_dockerfile() {
pushd "${DOCKERFILE_PATH}"
sudo docker build \
--build-arg http_proxy="${http_proxy}" \
--build-arg https_proxy="${https_proxy}" \
--tag "packaging-kata-test-${OS_DISTRIBUTION}" .
popd
}
remove_image_and_dockerfile() {
echo "Removing image test-${OS_DISTRIBUTION}"
sudo docker rmi "packaging-kata-test-${OS_DISTRIBUTION}"
echo "Removing dockerfile"
sudo rm -f "${DOCKERFILE_PATH}/Dockerfile"
}
function main() {
echo "Run packaging testing"
install_packages
}
main "$@"