docker-ce-packaging/verify

150 строки
4.6 KiB
Plaintext
Исходник Постоянная ссылка Обычный вид История

#!/usr/bin/env bash
###
# Script Name: verify
#
# Description: This runs a smoke test to verify that the packages can be installed corrected
###
# build/${DIST_ID}/${DIST_VERSION}/${ARCH} - location of all packages
# Manually Testing: docker run --rm -it -v $(pwd):/v -w /v "centos:7" ./verify
set -e
source install-containerd-helpers
function verify() {
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
}
function verify_binaries() {
docker --version
docker buildx version
docker compose version
dockerd --version
verify: check more binaries This verification is still very "bare boned", but makes sure that the binaries are not completely defunct, and that installation of the package installs the expected binaries. make IMAGE=ubuntu:jammy verify # ... + verify_binaries + docker --version Docker version 23.0.0-rc.2, build f163d24 ++ uname -m + '[' aarch64 = x86_64 ']' + docker buildx version github.com/docker/buildx v0.10.0 8764628 + docker compose version Docker Compose version v2.15.1 + dockerd --version Docker version 23.0.0-rc.2, build 9fd3a437 + docker-proxy --version docker-proxy (commit 9fd3a437) version 23.0.0-rc.2 + containerd --version containerd containerd.io 1.6.15 5b842e528e99d4d4c1686467debf2bd4b88ecd86 + ctr --version ctr containerd.io 1.6.15 + containerd-shim --help Usage of containerd-shim: -address string grpc address back to main containerd -containerd-binary containerd publish path to containerd binary (used for containerd publish) (default "containerd") -criu string path to criu binary -debug enable debug output in logs -namespace string namespace that owns the shim -runtime-root string root directory for the runtime (default "/run/containerd/runc") -socket string socket path to serve -systemd-cgroup set runtime to use systemd-cgroup -workdir string path used to storge large temporary data + containerd-shim-runc-v1 -v containerd-shim-runc-v1: Version: 1.6.15 Revision: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 Go version: go1.18.9 + containerd-shim-runc-v2 -v containerd-shim-runc-v2: Version: 1.6.15 Revision: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 Go version: go1.18.9 + runc --version runc version 1.1.4 commit: v1.1.4-0-g5fd4c4d spec: 1.0.2-dev go: go1.18.9 libseccomp: 2.5.3 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-11 17:47:53 +03:00
docker-proxy --version
containerd --version
verify: check more binaries This verification is still very "bare boned", but makes sure that the binaries are not completely defunct, and that installation of the package installs the expected binaries. make IMAGE=ubuntu:jammy verify # ... + verify_binaries + docker --version Docker version 23.0.0-rc.2, build f163d24 ++ uname -m + '[' aarch64 = x86_64 ']' + docker buildx version github.com/docker/buildx v0.10.0 8764628 + docker compose version Docker Compose version v2.15.1 + dockerd --version Docker version 23.0.0-rc.2, build 9fd3a437 + docker-proxy --version docker-proxy (commit 9fd3a437) version 23.0.0-rc.2 + containerd --version containerd containerd.io 1.6.15 5b842e528e99d4d4c1686467debf2bd4b88ecd86 + ctr --version ctr containerd.io 1.6.15 + containerd-shim --help Usage of containerd-shim: -address string grpc address back to main containerd -containerd-binary containerd publish path to containerd binary (used for containerd publish) (default "containerd") -criu string path to criu binary -debug enable debug output in logs -namespace string namespace that owns the shim -runtime-root string root directory for the runtime (default "/run/containerd/runc") -socket string socket path to serve -systemd-cgroup set runtime to use systemd-cgroup -workdir string path used to storge large temporary data + containerd-shim-runc-v1 -v containerd-shim-runc-v1: Version: 1.6.15 Revision: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 Go version: go1.18.9 + containerd-shim-runc-v2 -v containerd-shim-runc-v2: Version: 1.6.15 Revision: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 Go version: go1.18.9 + runc --version runc version 1.1.4 commit: v1.1.4-0-g5fd4c4d spec: 1.0.2-dev go: go1.18.9 libseccomp: 2.5.3 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-11 17:47:53 +03:00
ctr --version
containerd-shim -v
verify: check more binaries This verification is still very "bare boned", but makes sure that the binaries are not completely defunct, and that installation of the package installs the expected binaries. make IMAGE=ubuntu:jammy verify # ... + verify_binaries + docker --version Docker version 23.0.0-rc.2, build f163d24 ++ uname -m + '[' aarch64 = x86_64 ']' + docker buildx version github.com/docker/buildx v0.10.0 8764628 + docker compose version Docker Compose version v2.15.1 + dockerd --version Docker version 23.0.0-rc.2, build 9fd3a437 + docker-proxy --version docker-proxy (commit 9fd3a437) version 23.0.0-rc.2 + containerd --version containerd containerd.io 1.6.15 5b842e528e99d4d4c1686467debf2bd4b88ecd86 + ctr --version ctr containerd.io 1.6.15 + containerd-shim --help Usage of containerd-shim: -address string grpc address back to main containerd -containerd-binary containerd publish path to containerd binary (used for containerd publish) (default "containerd") -criu string path to criu binary -debug enable debug output in logs -namespace string namespace that owns the shim -runtime-root string root directory for the runtime (default "/run/containerd/runc") -socket string socket path to serve -systemd-cgroup set runtime to use systemd-cgroup -workdir string path used to storge large temporary data + containerd-shim-runc-v1 -v containerd-shim-runc-v1: Version: 1.6.15 Revision: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 Go version: go1.18.9 + containerd-shim-runc-v2 -v containerd-shim-runc-v2: Version: 1.6.15 Revision: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 Go version: go1.18.9 + runc --version runc version 1.1.4 commit: v1.1.4-0-g5fd4c4d spec: 1.0.2-dev go: go1.18.9 libseccomp: 2.5.3 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-11 17:47:53 +03:00
containerd-shim-runc-v1 -v
containerd-shim-runc-v2 -v
runc --version
}
function verify_deb() {
# 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.
apt-get update
apt-get -y install --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
lsb-release \
software-properties-common
DIST_ID=$(source /etc/os-release; echo "$ID")
DIST_VERSION=$(lsb_release -sc)
if [ "${DIST_VERSION}" = "sid" ]; then
echo 'Debian sid ("unstable") cannot be used for packaging: replace with the actual codename'
exit 1
fi
install_debian_containerd
packages=$(find "deb/debbuild/${DIST_ID}-${DIST_VERSION}/" -type f -name "*.deb")
# 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.
#
# shellcheck disable=SC2086
dpkg \
--ignore-depends=containerd.io,iptables,libdevmapper,libdevmapper1.02.1 \
--force-depends \
-i ${packages}
# 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.
#
# shellcheck disable=SC2086
apt-get -y install --no-install-recommends --no-upgrade --fix-broken ${packages}
)
verify_binaries
}
function verify_rpm() {
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"
dnf clean all
${pkg_manager} install -y 'dnf-command(config-manager)'
fi
case ${DIST_ID}:${DIST_VERSION} in
ol:7*)
# Needed for container-selinux
${pkg_config_manager} --enable ol7_addons
;;
fedora*)
dnf install -y findutils
;;
esac
install_rpm_containerd
# find all rpm packages, exclude src package
echo "[DEBUG] Installing engine rpms"
packages=$(find "rpm/rpmbuild/${DIST_ID}-${DIST_VERSION}/RPMS/" -type f -name "*.rpm" | sed '/src/d')
# install all non-source packages
(
set -x
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
${pkg_manager} install -y ${packages}
)
verify_binaries
}
verify