2019-10-21 23:49:33 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
###
|
|
|
|
# Script Name: verify
|
|
|
|
#
|
|
|
|
# Description: This runs a smoke test to verify that the packages can be installed corrected
|
|
|
|
###
|
|
|
|
|
2022-05-19 17:29:28 +03:00
|
|
|
# build/${DIST_ID}/${DIST_VERSION}/${ARCH} - location of all packages
|
2019-10-21 23:49:33 +03:00
|
|
|
# Manually Testing: docker run --rm -it -v $(pwd):/v -w /v "centos:7" ./verify
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
source install-containerd-helpers
|
|
|
|
|
|
|
|
function verify() {
|
2020-02-20 14:55:02 +03:00
|
|
|
if dpkg --version >/dev/null 2>/dev/null; then
|
|
|
|
verify_deb
|
|
|
|
elif rpm --version >/dev/null 2>/dev/null; then
|
|
|
|
verify_rpm
|
|
|
|
else
|
|
|
|
echo "[ERROR] Unable to determine base os:"
|
|
|
|
cat /etc/os-release
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-10-21 23:49:33 +03:00
|
|
|
}
|
|
|
|
|
2022-08-24 02:30:32 +03:00
|
|
|
function verify_binaries() {
|
|
|
|
docker --version
|
|
|
|
docker buildx version
|
|
|
|
docker compose version
|
|
|
|
dockerd --version
|
2023-01-11 17:47:53 +03:00
|
|
|
docker-proxy --version
|
2022-08-24 02:30:32 +03:00
|
|
|
containerd --version
|
2023-01-11 17:47:53 +03:00
|
|
|
ctr --version
|
2024-08-06 11:32:00 +03:00
|
|
|
containerd-shim -v
|
2023-01-11 17:47:53 +03:00
|
|
|
containerd-shim-runc-v1 -v
|
|
|
|
containerd-shim-runc-v2 -v
|
2022-08-24 02:30:32 +03:00
|
|
|
runc --version
|
|
|
|
}
|
|
|
|
|
2019-10-21 23:49:33 +03:00
|
|
|
function verify_deb() {
|
2021-04-07 11:55:31 +03:00
|
|
|
# First install prerequisites for our script and dpkg and apt to run correctly.
|
|
|
|
# This list SHOULD NOT include dependencies of docker itself, otherwise we would
|
|
|
|
# not be able to verify that our packages specify all the required dependencies.
|
2020-02-20 14:55:02 +03:00
|
|
|
apt-get update
|
2020-02-20 14:59:19 +03:00
|
|
|
apt-get -y install --no-install-recommends \
|
2020-02-20 14:55:02 +03:00
|
|
|
apt-transport-https \
|
2020-02-20 14:59:19 +03:00
|
|
|
ca-certificates \
|
2020-02-20 14:55:02 +03:00
|
|
|
curl \
|
|
|
|
gnupg2 \
|
|
|
|
lsb-release \
|
|
|
|
software-properties-common
|
|
|
|
|
|
|
|
DIST_ID=$(source /etc/os-release; echo "$ID")
|
|
|
|
DIST_VERSION=$(lsb_release -sc)
|
2021-04-07 11:46:21 +03:00
|
|
|
if [ "${DIST_VERSION}" = "sid" ]; then
|
|
|
|
echo 'Debian sid ("unstable") cannot be used for packaging: replace with the actual codename'
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-02-20 14:55:02 +03:00
|
|
|
|
|
|
|
install_debian_containerd
|
|
|
|
|
2022-05-19 17:29:28 +03:00
|
|
|
packages=$(find "deb/debbuild/${DIST_ID}-${DIST_VERSION}/" -type f -name "*.deb")
|
2020-02-20 14:55:02 +03:00
|
|
|
# All local packages need to be prefixed with `./` or else apt-get doesn't understand where to pull from
|
|
|
|
packages=$(echo "${packages}" | awk '$0="./"$0' | xargs)
|
|
|
|
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
# Install the locally built packages using 'dpkg' because installing with
|
|
|
|
# 'apt-get' would attempt to install dependency packages (such as the CLI)
|
|
|
|
# from download.docker.com instead of the locally built CLI package. Given
|
|
|
|
# that 'dpkg -i' does not install any dependency (but will fail if depen-
|
|
|
|
# dencies are missing), we use the '--ignore-depends' option to ignore
|
|
|
|
# packages we know to be missing at this stage, and '--force-depends' to
|
|
|
|
# only warn about any other missing dependency.
|
|
|
|
#
|
2021-04-01 17:36:44 +03:00
|
|
|
# shellcheck disable=SC2086
|
2020-02-20 14:55:02 +03:00
|
|
|
dpkg \
|
|
|
|
--ignore-depends=containerd.io,iptables,libdevmapper,libdevmapper1.02.1 \
|
|
|
|
--force-depends \
|
|
|
|
-i ${packages}
|
2021-04-01 17:36:44 +03:00
|
|
|
|
2021-04-07 11:55:31 +03:00
|
|
|
# After installing the local packages, we run 'apt-get install' with the
|
|
|
|
# '--fix-broken' option to trigger installation of the dependencies, which
|
|
|
|
# should succeed successfully. This step is to verify that not only the
|
|
|
|
# packages can be installed, but also that all dependencies (including
|
|
|
|
# containerd.io) can be resolved correctly for the distro that we built for,
|
|
|
|
# before going through the whole pipeline and publishing the packages.
|
|
|
|
#
|
|
|
|
# The '--no-upgrade' option is set to prevent apt from attempting to install
|
|
|
|
# packages from download(-stage).docker.com that we already installed using
|
|
|
|
# the local packages above. Without this, installing (e.g.) ./docker-ce-cli
|
|
|
|
# would result in apt installing "docker-ce" from the package repository and
|
|
|
|
# produce a "the following packages will be DOWNGRADED" error.
|
|
|
|
#
|
2021-04-01 17:36:44 +03:00
|
|
|
# shellcheck disable=SC2086
|
2021-04-07 11:55:31 +03:00
|
|
|
apt-get -y install --no-install-recommends --no-upgrade --fix-broken ${packages}
|
2020-02-20 14:55:02 +03:00
|
|
|
)
|
2022-08-24 02:30:32 +03:00
|
|
|
|
|
|
|
verify_binaries
|
2019-10-21 23:49:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function verify_rpm() {
|
2020-02-20 14:55:02 +03:00
|
|
|
DIST_ID=$(. /etc/os-release; echo "${ID}")
|
|
|
|
DIST_VERSION=$(. /etc/os-release; echo "${VERSION_ID}" | cut -d'.' -f1)
|
|
|
|
|
|
|
|
pkg_manager="yum"
|
|
|
|
pkg_config_manager="yum-config-manager"
|
|
|
|
if dnf --version; then
|
|
|
|
pkg_manager="dnf"
|
|
|
|
pkg_config_manager="dnf config-manager"
|
2022-08-08 15:19:24 +03:00
|
|
|
dnf clean all
|
2020-02-20 14:55:02 +03:00
|
|
|
${pkg_manager} install -y 'dnf-command(config-manager)'
|
|
|
|
fi
|
|
|
|
|
|
|
|
case ${DIST_ID}:${DIST_VERSION} in
|
|
|
|
ol:7*)
|
|
|
|
# Needed for container-selinux
|
2020-02-20 15:05:26 +03:00
|
|
|
${pkg_config_manager} --enable ol7_addons
|
2020-02-20 14:55:02 +03:00
|
|
|
;;
|
|
|
|
fedora*)
|
|
|
|
dnf install -y findutils
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
install_rpm_containerd
|
|
|
|
|
|
|
|
# find all rpm packages, exclude src package
|
|
|
|
echo "[DEBUG] Installing engine rpms"
|
2022-05-19 17:29:28 +03:00
|
|
|
packages=$(find "rpm/rpmbuild/${DIST_ID}-${DIST_VERSION}/RPMS/" -type f -name "*.rpm" | sed '/src/d')
|
2020-02-20 14:55:02 +03:00
|
|
|
|
|
|
|
# install all non-source packages
|
|
|
|
(
|
|
|
|
set -x
|
2022-08-08 16:05:45 +03:00
|
|
|
product_version=$(source /etc/os-release; echo "${REDHAT_SUPPORT_PRODUCT_VERSION:-}")
|
|
|
|
if [ "$product_version" = 'rawhide' ]; then
|
|
|
|
# force $releasever to account for Fedora pre-release images, as they
|
|
|
|
# may still be using "rawhide", which is not present on our package
|
|
|
|
# repositories on download.docker.com.
|
|
|
|
export DNF_VAR_releasever="$DIST_VERSION"
|
|
|
|
fi
|
2020-02-20 14:55:02 +03:00
|
|
|
${pkg_manager} install -y ${packages}
|
|
|
|
)
|
2021-03-31 16:07:22 +03:00
|
|
|
|
2022-08-24 02:30:32 +03:00
|
|
|
verify_binaries
|
2019-10-21 23:49:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
verify
|