Cirrus: Update Ubuntu images to 21.04

Also simplify `lib.sh` after supporting changes incorporated
into automation library 2.x+ (present in all VM and container
images).

* No need to force-load `/etc/profile` and handle it's expectation
  to **not** being in `errexit` mode.
* Slightly re-arrange loading of automation library files for
  clarity.
* Remove dependency on updating `/etc/environment` for GPG.
* Remove redundant showrun() function (now present in automation
  library)
* Update comments.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich 2021-04-26 11:33:50 -04:00
parent 9428d03194
commit 174cf8963f
No known key found for this signature in database
GPG Key ID: 03EDC70FD578067F
4 changed files with 16 additions and 34 deletions

View File

@ -28,8 +28,8 @@ env:
# See https://github.com/containers/podman/blob/master/contrib/cirrus/README.md#test_build_cache_images_task-task # See https://github.com/containers/podman/blob/master/contrib/cirrus/README.md#test_build_cache_images_task-task
FEDORA_NAME: "fedora-34beta" FEDORA_NAME: "fedora-34beta"
PRIOR_FEDORA_NAME: "fedora-33" PRIOR_FEDORA_NAME: "fedora-33"
UBUNTU_NAME: "ubuntu-2010" UBUNTU_NAME: "ubuntu-2104"
PRIOR_UBUNTU_NAME: "ubuntu-2004" PRIOR_UBUNTU_NAME: "ubuntu-2010"
IMAGE_SUFFIX: "c5032481331085312" IMAGE_SUFFIX: "c5032481331085312"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}" FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"

View File

@ -3,38 +3,28 @@
# Library of common, shared utility functions. This file is intended # Library of common, shared utility functions. This file is intended
# to be sourced by other scripts, not called directly. # to be sourced by other scripts, not called directly.
# BEGIN Global export of all variables
set -a
# Due to differences across platforms and runtime execution environments, # Due to differences across platforms and runtime execution environments,
# handling of the (otherwise) default shell setup is non-uniform. Rather # handling of the (otherwise) default shell setup is non-uniform. Rather
# than attempt to workaround differences, simply force-load/set required # than attempt to workaround differences, simply force-load/set required
# items every time this library is utilized. # items every time this library is utilized.
_waserrexit=0
if [[ "$SHELLOPTS" =~ errexit ]]; then _waserrexit=1; fi
set +e # Assumed in F33 for setting global vars
set -a
if [[ -r "/etc/automation_environment" ]]; then
source /etc/automation_environment
else # prior to automation library v2.0, this was necessary
source /etc/profile
source /etc/environment
fi
USER="$(whoami)" USER="$(whoami)"
HOME="$(getent passwd $USER | cut -d : -f 6)" HOME="$(getent passwd $USER | cut -d : -f 6)"
# Some platforms set and make this read-only # Some platforms set and make this read-only
[[ -n "$UID" ]] || \ [[ -n "$UID" ]] || \
UID=$(getent passwd $USER | cut -d : -f 3) UID=$(getent passwd $USER | cut -d : -f 3)
if ((_waserrexit)); then set -e; fi
# During VM Image build, the 'containers/automation' installation # Automation library installed at image-build time,
# was performed. The final step of that installation sets the # defining $AUTOMATION_LIB_PATH in this file.
# installation location in $AUTOMATION_LIB_PATH in /etc/environment if [[ -r "/etc/automation_environment" ]]; then
# or in the default shell profile. source /etc/automation_environment
fi
# shellcheck disable=SC2154 # shellcheck disable=SC2154
if [[ -n "$AUTOMATION_LIB_PATH" ]]; then if [[ -n "$AUTOMATION_LIB_PATH" ]]; then
for libname in defaults anchors console_output utils; do # shellcheck source=/usr/share/automation/lib/common_lib.sh
# There's no way shellcheck can process this location source $AUTOMATION_LIB_PATH/common_lib.sh
# shellcheck disable=SC1090
source $AUTOMATION_LIB_PATH/${libname}.sh
done
else else
( (
echo "WARNING: It does not appear that containers/automation was installed." echo "WARNING: It does not appear that containers/automation was installed."
@ -43,6 +33,9 @@ else
) > /dev/stderr ) > /dev/stderr
fi fi
# Required for proper GPG functioning under automation
GPG_TTY="${GPG_TTY:-/dev/null}"
# Essential default paths, many are overridden when executing under Cirrus-CI # Essential default paths, many are overridden when executing under Cirrus-CI
# others are duplicated here, to assist in debugging. # others are duplicated here, to assist in debugging.
GOPATH="${GOPATH:-/var/tmp/go}" GOPATH="${GOPATH:-/var/tmp/go}"
@ -112,19 +105,13 @@ LONG_DNFY="bigto dnf -y"
# Allow easy substitution for debugging if needed # Allow easy substitution for debugging if needed
CONTAINER_RUNTIME="showrun ${CONTAINER_RUNTIME:-podman}" CONTAINER_RUNTIME="showrun ${CONTAINER_RUNTIME:-podman}"
# END Global export of all variables
set +a set +a
bad_os_id_ver() { bad_os_id_ver() {
die "Unknown/Unsupported distro. $OS_RELEASE_ID and/or version $OS_RELEASE_VER for $(basename $0)" die "Unknown/Unsupported distro. $OS_RELEASE_ID and/or version $OS_RELEASE_VER for $(basename $0)"
} }
showrun() {
local -a context
context=($(caller 0))
echo "+ $@ # ${context[2]}:${context[0]} in ${context[1]}()" > /dev/stderr
"$@"
}
# Remove all files provided by the distro version of buildah. # Remove all files provided by the distro version of buildah.
# All VM cache-images used for testing include the distro buildah because it # All VM cache-images used for testing include the distro buildah because it
# simplifies installing necessary dependencies which can change over time. # simplifies installing necessary dependencies which can change over time.

View File

@ -42,10 +42,6 @@ esac
# Previously, golang was not installed # Previously, golang was not installed
source $(dirname $0)/lib.sh source $(dirname $0)/lib.sh
X="export GPG_TTY=/dev/null"
echo "Setting $X in /etc/environment for proper GPG functioning under automation"
echo "$X" >> /etc/environment
echo "Configuring /etc/containers/registries.conf" echo "Configuring /etc/containers/registries.conf"
mkdir -p /etc/containers mkdir -p /etc/containers
echo -e "[registries.search]\nregistries = ['docker.io', 'registry.fedoraproject.org', 'quay.io']" | tee /etc/containers/registries.conf echo -e "[registries.search]\nregistries = ['docker.io', 'registry.fedoraproject.org', 'quay.io']" | tee /etc/containers/registries.conf

View File

@ -31,7 +31,6 @@ if [[ "$1" == "--config" ]]; then
cat <<EOF cat <<EOF
DESTDIR="/var/tmp/go/src/github.com/containers/buildah" DESTDIR="/var/tmp/go/src/github.com/containers/buildah"
UPSTREAM_REPO="https://github.com/containers/buildah.git" UPSTREAM_REPO="https://github.com/containers/buildah.git"
CI_ENVFILE="/etc/environment"
GCLOUD_PROJECT="buildah" GCLOUD_PROJECT="buildah"
GCLOUD_IMGPROJECT="libpod-218412" GCLOUD_IMGPROJECT="libpod-218412"
GCLOUD_CFG="buildah" GCLOUD_CFG="buildah"