Cirrus: Add support for Ubuntu 20.x

Previously automation always dropped the minor version number for
distributions.  This was intended for presentation and conditional
simplicity. Bash does not support non-integer comparison natively.

With the release of version 20.10, supporting testing with it and
the LTS release (20.04) requires scripts to consider minor version
numbers for Ubuntu VMs.  This is necessary because many times in
the past, some behaviors needed to be conditional on the release
version number.

With this commit, the images and embedded scripts/tooling uses an
altered format of `$UBUNTU_NAME', `$PRIOR_UBUNTU_NAME`, and (crucially)
`$OS_RELEASE_VER` and `$OS_REL_VER`.  Any `.` characters appearing
in the official version (from `/etc/os-release`) are dropped, and
the result is concatenated.

For example the current Ubuntu LTS version is `20.04`.  Prior to
this commit, `$OS_RELEASE_VER` would have been `20`.  With this
change, `$OS_RELEASE_VER` will now show `2004`.  Similarly `20.10`
is shown as `2010`.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich
2020-11-12 09:10:18 -05:00
parent 66e979a892
commit e3ba7092fb
5 changed files with 25 additions and 28 deletions

View File

@ -26,11 +26,11 @@ env:
####
FEDORA_NAME: "fedora-33"
PRIOR_FEDORA_NAME: "fedora-32"
UBUNTU_NAME: "ubuntu-20"
PRIOR_UBUNTU_NAME: "ubuntu-19"
UBUNTU_NAME: "ubuntu-2010"
PRIOR_UBUNTU_NAME: "ubuntu-2004"
# Google-cloud VM Images
IMAGE_SUFFIX: "c4704091098054656"
IMAGE_SUFFIX: "c6233039174893568"
FEDORA_CACHE_IMAGE_NAME: "fedora-${IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "prior-fedora-${IMAGE_SUFFIX}"
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-${IMAGE_SUFFIX}"

View File

@ -41,7 +41,7 @@ fi
OS_RELEASE_ID="$(source /etc/os-release; echo $ID)"
# GCE image-name compatible string representation of distribution _major_ version
OS_RELEASE_VER="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)"
OS_RELEASE_VER="$(source /etc/os-release; echo $VERSION_ID | tr -d '.')"
# Combined to ease soe usage
OS_REL_VER="${OS_RELEASE_ID}-${OS_RELEASE_VER}"
# This is normally set from .cirrus.yml but default is necessary when

View File

@ -53,7 +53,7 @@ case $1 in
slirp4netns \
)
case $OS_RELEASE_ID in
fedora*)
fedora)
cat /etc/fedora-release
PKG_LST_CMD='rpm -q --qf=%{N}-%{V}-%{R}-%{ARCH}\n'
PKG_NAMES+=(\
@ -61,7 +61,7 @@ case $1 in
libseccomp \
)
;;
ubuntu*)
ubuntu)
cat /etc/issue
PKG_LST_CMD='dpkg-query --show --showformat=${Package}-${Version}-${Architecture}\n'
PKG_NAMES+=(\

View File

@ -41,7 +41,7 @@ function _run_automation() {
req_env_vars CI DEST_BRANCH IMAGE_SUFFIX TEST_FLAVOR TEST_ENVIRON \
PODBIN_NAME PRIV_NAME DISTRO_NV CONTAINER USER HOME \
UID AUTOMATION_LIB_PATH SCRIPT_BASE OS_RELEASE_ID \
OS_RELEASE_VER CG_FS_TYPE
CG_FS_TYPE
bigto ooe.sh dnf install -y ShellCheck # small/quick addition
$SCRIPT_BASE/shellcheck.sh
}
@ -64,12 +64,6 @@ function _run_unit() {
}
function _run_apiv2() {
# TODO Remove once VM's with dependency
if [[ "$OS_RELEASE_ID" == "fedora" ]]; then
dnf install -y python3-docker
else
apt-get -qq -y install python3-docker
fi
make localapiv2 |& logformatter
}

View File

@ -73,7 +73,9 @@ case "$CG_FS_TYPE" in
if ((CONTAINER==0)); then
warn "Forcing testing with runc instead of crun"
if [[ "$OS_RELEASE_ID" == "ubuntu" ]]; then
echo "OCI_RUNTIME=/usr/lib/cri-o-runc/sbin/runc" >> /etc/ci_environment
# Need b/c using cri-o-runc package from OBS
echo "OCI_RUNTIME=/usr/lib/cri-o-runc/sbin/runc" \
>> /etc/ci_environment
else
echo "OCI_RUNTIME=runc" >> /etc/ci_environment
fi
@ -102,8 +104,8 @@ fi
# Which distribution are we testing on.
case "$OS_RELEASE_ID" in
ubuntu*) ;;
fedora*)
ubuntu) ;;
fedora)
if ((CONTAINER==0)); then
msg "Configuring / Expanding host storage."
# VM is setup to allow flexibility in testing alternate storage.
@ -123,10 +125,15 @@ esac
# shellcheck disable=SC2154
case "$TEST_ENVIRON" in
host)
if [[ "$OS_RELEASE_ID" == "fedora" ]]; then
# The e2e tests wrongly guess `--cgroup-manager cgroupfs`
# The e2e tests wrongly guess `--cgroup-manager` option
# shellcheck disable=SC2154
if [[ "$CG_FS_TYPE" == "cgroup2fs" ]] || [[ "$PRIV_NAME" == "root" ]]
then
warn "Forcing CGROUP_MANAGER=systemd"
echo "CGROUP_MANAGER=systemd" >> /etc/ci_environment
else
warn "Forcing CGROUP_MANAGER=cgroupfs"
echo "CGROUP_MANAGER=cgroupfs" >> /etc/ci_environment
fi
;;
container)
@ -138,25 +145,21 @@ case "$TEST_ENVIRON" in
modprobe ip6table_nat || :
modprobe iptable_nat || :
else
# The e2e tests wrongly guess `--cgroup-manager systemd`
warn "Forcing CGROUP_MANAGER=cgroupfs"
echo "CGROUP_MANAGER=cgroupfs" >> /etc/ci_environment
fi
;;
*) die_unknown TEST_ENVIRON
esac
# Required to be defined by caller: Are we testing as root or a regular user
# shellcheck disable=SC2154
case "$PRIV_NAME" in
root)
if [[ "$TEST_ENVIRON" == "container" ]] && ((container)); then
# There's no practical way to detect userns w/in a container
# affected/related tests are sensitive to this variable.
warn "Disabling usernamespace integration testing"
echo "SKIP_USERNS=1" >> /etc/ci_environment
fi
;;
*) die_unknown TEST_ENVIRON
esac
# Required to be defined by caller: Are we testing as root or a regular user
case "$PRIV_NAME" in
root) ;;
rootless)
# Needs to exist for setup_rootless()
ROOTLESS_USER="${ROOTLESS_USER:-some${RANDOM}dude}"