From a18a32e793bb6f3989a3a76683a46c7ac52c24ed Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 22 Jun 2022 15:20:53 -0400 Subject: [PATCH] Use packaged bats in Fedora, side-load for Ubuntu Fixes https://github.com/containers/automation_images/issues/139 N/B: Using these images requires an update to the podman repo. to remove the bats installer script and `Makefile` target. Signed-off-by: Chris Evich --- cache_images/fedora_packaging.sh | 1 + cache_images/podman_tooling.sh | 16 +++++++++++++++- cache_images/ubuntu_packaging.sh | 6 ++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cache_images/fedora_packaging.sh b/cache_images/fedora_packaging.sh index aa049515..90c1f298 100644 --- a/cache_images/fedora_packaging.sh +++ b/cache_images/fedora_packaging.sh @@ -41,6 +41,7 @@ INSTALL_PACKAGES=(\ autoconf automake bash-completion + bats bridge-utils btrfs-progs-devel buildah diff --git a/cache_images/podman_tooling.sh b/cache_images/podman_tooling.sh index 6369965b..7220a25c 100644 --- a/cache_images/podman_tooling.sh +++ b/cache_images/podman_tooling.sh @@ -6,7 +6,7 @@ # as root or through sudo. The script should not be used for any other # purpose or from any other context. -set -e +set -eo pipefail SCRIPT_FILEPATH=$(realpath "${BASH_SOURCE[0]}") SCRIPT_DIRPATH=$(dirname "$SCRIPT_FILEPATH") @@ -14,6 +14,20 @@ REPO_DIRPATH=$(realpath "$SCRIPT_DIRPATH/../") # shellcheck source=./lib.sh source "$REPO_DIRPATH/lib.sh" +if [[ "$OS_RELEASE_ID" == "ubuntu" ]]; then + if [[ -n "$(type -P bats)" ]]; then + die "Bats _MUST_ not be installed on ubuntu until fixed: https://bugs.launchpad.net/ubuntu/+source/bats/+bug/1882542" + fi + bats_version="1.7.0" + dl_url="https://github.com/bats-core/bats-core/archive/v${bats_version}.tar.gz" + echo "Installing bats $bats_version" + curl --fail --location "$dl_url" | tar xzv -C /tmp + pushd /tmp/bats-core-$bats_version + $SUDO ./install.sh /usr/local # prints install location + popd + rm -rf /tmp/bats-core-$bats_version +fi + echo "Configuring Go environment" export GOPATH="${GOPATH:-/var/tmp/go}" mkdir -p "$GOPATH" diff --git a/cache_images/ubuntu_packaging.sh b/cache_images/ubuntu_packaging.sh index 44d3eb7e..bb99ce47 100644 --- a/cache_images/ubuntu_packaging.sh +++ b/cache_images/ubuntu_packaging.sh @@ -21,7 +21,6 @@ bigto ooe.sh $SUDO apt-get -qq -y upgrade echo "Configuring additional package repositories" - # Useful version of criu is only available from launchpad repo if [[ "$OS_RELEASE_VER" -le 2004 ]]; then lilto ooe.sh $SUDO add-apt-repository --yes ppa:criu/ppa @@ -44,9 +43,8 @@ curl --fail --silent --location --url "$GPG_URL" | \ $SUDO tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable_ci.gpg &> /dev/null -# Removed golang-1.14 from install packages due to known -# performance reason. Reinstall when ubuntu has 1.16. - +# N/B: DO NOT install the bats package on Ubuntu VMs, it's broken. +# ref: (still open) https://bugs.launchpad.net/ubuntu/+source/bats/+bug/1882542 INSTALL_PACKAGES=(\ apache2-utils apparmor