2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2020-01-24 19:51:04 +00:00
|
|
|
################################################################################
|
2023-11-22 21:49:23 +01:00
|
|
|
## File: install-container-tools.sh
|
|
|
|
|
## Desc: Install container tools: podman, buildah and skopeo onto the image
|
2020-01-24 19:51:04 +00:00
|
|
|
################################################################################
|
|
|
|
|
|
2023-12-29 12:36:27 +01:00
|
|
|
# Source the helpers for use with the script
|
2022-05-25 20:25:12 +04:00
|
|
|
source $HELPER_SCRIPTS/os.sh
|
|
|
|
|
|
2023-09-04 10:50:30 +02:00
|
|
|
#
|
|
|
|
|
# pin podman due to https://github.com/actions/runner-images/issues/7753
|
|
|
|
|
# https://bugs.launchpad.net/ubuntu/+source/libpod/+bug/2024394
|
|
|
|
|
#
|
2024-04-26 23:18:26 +02:00
|
|
|
if ! is_ubuntu22; then
|
2023-09-04 10:50:30 +02:00
|
|
|
install_packages=(podman buildah skopeo)
|
|
|
|
|
else
|
|
|
|
|
install_packages=(podman=3.4.4+ds1-1ubuntu1 buildah skopeo)
|
|
|
|
|
fi
|
2021-04-08 14:13:21 +03:00
|
|
|
|
2022-05-25 20:25:12 +04:00
|
|
|
# Packages is available in the official Ubuntu upstream starting from Ubuntu 21
|
2023-12-26 12:50:52 +01:00
|
|
|
if is_ubuntu20; then
|
2023-12-29 18:11:55 +01:00
|
|
|
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_$(lsb_release -rs)"
|
|
|
|
|
GPG_KEY="/usr/share/keyrings/devel_kubic_libcontainers_stable.gpg"
|
|
|
|
|
REPO_PATH="/etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
|
|
|
|
|
|
|
|
|
|
curl -fsSL "${REPO_URL}/Release.key" | gpg --dearmor -o $GPG_KEY
|
|
|
|
|
echo "deb [arch=amd64 signed-by=$GPG_KEY] ${REPO_URL}/ /" > $REPO_PATH
|
2022-05-25 20:25:12 +04:00
|
|
|
fi
|
|
|
|
|
|
2024-04-26 23:18:26 +02:00
|
|
|
# Install podman, buildah, skopeo container's tools
|
2022-05-25 20:25:12 +04:00
|
|
|
apt-get update
|
2024-05-29 13:43:07 +02:00
|
|
|
apt-get install ${install_packages[@]}
|
2020-01-24 19:51:04 +00:00
|
|
|
mkdir -p /etc/containers
|
2023-11-28 15:22:35 +01:00
|
|
|
printf "[registries.search]\nregistries = ['docker.io', 'quay.io']\n" | tee /etc/containers/registries.conf
|
2020-12-02 18:46:08 +07:00
|
|
|
|
2023-12-26 12:50:52 +01:00
|
|
|
if is_ubuntu20; then
|
2022-05-25 20:25:12 +04:00
|
|
|
# Remove source repo
|
2023-12-29 18:11:55 +01:00
|
|
|
rm $GPG_KEY
|
|
|
|
|
rm $REPO_PATH
|
|
|
|
|
|
2022-05-25 20:25:12 +04:00
|
|
|
# Document source repo
|
|
|
|
|
echo "containers $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt
|
|
|
|
|
fi
|
|
|
|
|
|
2021-02-18 09:03:13 +03:00
|
|
|
invoke_tests "Tools" "Containers"
|