Skip to content

Commit

Permalink
Cirrus: Use libpod cache-images
Browse files Browse the repository at this point in the history
Previously automation on this project used the low-level VM images
mostly as-is from google.  However, due to many items fixed by
containers/podman#3632 it makes more sense
to use the cache-images instead.

Non-deterministic behavior is a severe detriment to testing
reliability.  By using the libpod cache-images, this projects inherits
the libpod PR-based image-build workflow, a slew of pre-installed
packages, along with disabled default background services.

This should result in both faster and more reliable testing.

Signed-off-by: Chris Evich <cevich@redhat.com>
  • Loading branch information
cevich committed Nov 8, 2019
1 parent b3fc9ce commit 7c898fa
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 28 deletions.
12 changes: 9 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ env:
####
# GCE project where images live
IMAGE_PROJECT: "libpod-218412"
FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-30-1-2-1556821664"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-cloud-base-29-1-2-1541789245"
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-1904-disco-v20190514"
_BUILT_IMAGE_SUFFIX: "libpod-5816955207942144"
FEDORA_CACHE_IMAGE_NAME: "fedora-30-${_BUILT_IMAGE_SUFFIX}"
PRIOR_FEDORA_CACHE_IMAGE_NAME: "fedora-29-${_BUILT_IMAGE_SUFFIX}"
UBUNTU_CACHE_IMAGE_NAME: "ubuntu-19-${_BUILT_IMAGE_SUFFIX}"
PRIOR_UBUNTU_CACHE_IMAGE_NAME: "ubuntu-18-${_BUILT_IMAGE_SUFFIX}"

####
#### Command variables to help avoid duplication
Expand Down Expand Up @@ -49,11 +51,14 @@ gce_instance:
image_name: "${FEDORA_CACHE_IMAGE_NAME}"

testing_task:
depends_on:
- lint
gce_instance: # Only need to specify differences from defaults (above)
matrix: # Duplicate this task for each matrix product.
image_name: "${FEDORA_CACHE_IMAGE_NAME}"
image_name: "${PRIOR_FEDORA_CACHE_IMAGE_NAME}"
image_name: "${UBUNTU_CACHE_IMAGE_NAME}"
# image_name: "${PRIOR_UBUNTU_CACHE_IMAGE_NAME}" # No fuse3 support

# Separate scripts for separate outputs, makes debugging easier.
setup_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
Expand Down Expand Up @@ -99,6 +104,7 @@ meta_task:
${FEDORA_CACHE_IMAGE_NAME}
${PRIOR_FEDORA_CACHE_IMAGE_NAME}
${UBUNTU_CACHE_IMAGE_NAME}
${PRIOR_UBUNTU_CACHE_IMAGE_NAME}
BUILDID: "${CIRRUS_BUILD_ID}"
REPOREF: "${CIRRUS_CHANGE_IN_REPO}"
GCPJSON: ENCRYPTED[244a93fe8b386b48b96f748342bf741350e43805eee81dd04b45093bdf737e540b993fc735df41f131835fa0f9b65826]
Expand Down
24 changes: 17 additions & 7 deletions contrib/cirrus/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ cd $GOSRC
make install.tools
showrun make local-binary
showrun make local-cross
showrun make STORAGE_DRIVER=overlay local-test-integration

showrun make local-test-unit

# TODO: Some integration tests fail on Fedora
if [[ "$OS_RELEASE_ID" != "fedora" ]]; then
showrun make STORAGE_DRIVER=overlay local-test-integration
fi

showrun make STORAGE_DRIVER=overlay STORAGE_OPTION=overlay.mount_program=/usr/bin/fuse-overlayfs local-test-integration

showrun make STORAGE_DRIVER=overlay FUSE_OVERLAYFS_DISABLE_OVL_WHITEOUT=1 STORAGE_OPTION=overlay.mount_program=/usr/bin/fuse-overlayfs local-test-integration

showrun make STORAGE_DRIVER=vfs local-test-integration
showrun make local-test-unit

case "$OS_REL_VER" in
ubuntu-19)
showrun make STORAGE_DRIVER=aufs local-test-integration
;;
esac
if [[ "$OS_RELEASE_ID" == "ubuntu" ]]; then
showrun make STORAGE_DRIVER=aufs local-test-integration
fi

# TODO: Requires partitioning of $(cat /root/second_partition_ready) device after running
# https://github.com/containers/libpod/blob/v1.6.2/contrib/cirrus/add_second_partition.sh
#
#showrun make STORAGE_DRIVER=devicemapper STORAGE_OPTION=dm.directlvm_device=/dev/abc local-test-integration
11 changes: 11 additions & 0 deletions contrib/cirrus/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ OS_RELEASE_VER="$(source /etc/os-release; echo $VERSION_ID | cut -d '.' -f 1)"
# Combined to ease soe usage
OS_REL_VER="${OS_RELEASE_ID}-${OS_RELEASE_VER}"

# Working with dnf + timeout/retry
export SHORT_DNFY='timeout_attempt_delay_command 120s 5 30s dnf -y'
export LONG_DNFY='timeout_attempt_delay_command 300s 5 60s dnf -y'
# Working with apt under Debian/Ubuntu automation is a PITA, make it easy
# Avoid some ways of getting stuck waiting for user input
export DEBIAN_FRONTEND=noninteractive
Expand All @@ -66,6 +69,14 @@ SHORT_APTGET="timeout_attempt_delay_command 120s 5 60s $SUDOAPTGET"
# Long list / long-running command
LONG_APTGET="timeout_attempt_delay_command 300s 5 60s $SUDOAPTGET"

# Packaging adjustments needed to:
# https://github.com/containers/libpod/blob/master/contrib/cirrus/packer/fedora_setup.sh
RPMS_REQUIRED="autoconf automake"
RPMS_CONFLICTING="gcc-go"
# https://github.com/containers/libpod/blob/master/contrib/cirrus/packer/ubuntu_setup.sh
DEBS_REQUIRED=""
DEBS_CONFLICTING=""

# Pass in a list of one or more envariable names; exit non-zero with
# helpful error message if any value is empty
req_env_var() {
Expand Down
35 changes: 18 additions & 17 deletions contrib/cirrus/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,37 @@ set -e

source $(dirname $0)/lib.sh

req_env_var GOSRC OS_RELEASE_ID OS_RELEASE_VER SHORT_APTGET

install_ooe

show_env_vars

cd $GOSRC

export RPMBuildRequires="podman autoconf automake gcc golang go-md2man gpgme-devel device-mapper-devel btrfs-progs-devel libassuan-devel libseccomp-devel glib2-devel make bats fuse3-devel fuse3"
export RPMBuildConflicts="gcc-go"
export AptBuildRequires="autoconf automake gcc golang go-md2man libgpgme11-dev libdevmapper-dev libseccomp-dev libglib2.0-dev make bats aufs-tools fuse3 libfuse3-dev libbtrfs-dev"
export AptBuildConflicts="cryptsetup-initramfs"

case "$OS_REL_VER" in
fedora-*)
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructions here
dnf -y update
dnf -y install $RPMBuildRequires
dnf -y remove $RPMBuildConflicts
install_fuse_overlayfs_from_git
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER"
case "$OS_RELEASE_ID" in
fedora)
$LONG_DNFY update # install latest packages
[[ -z "$RPMS_REQUIRED" ]] || \
$SHORT_DNFY install $RPMS_REQUIRED
[[ -z "$RPMS_CONFLICTING" ]] || \
$SHORT_DNFY erase $RPMS_CONFLICTING
;;
ubuntu-19)
echo "Setting up $OS_RELEASE_ID $OS_RELEASE_VER" # STUB: Add VM setup instructions here
ubuntu)
$SHORT_APTGET update # Fetch latest package metadata
$SHORT_APTGET -qq remove $AptBuildConflicts
$LONG_APTGET -qq install $AptBuildRequires
install_fuse_overlayfs_from_git
$LONG_APTGET upgrade # install latest packages
[[ -z "$DEBS_REQUIRED" ]] || \
$SHORT_APTGET -q install $DEBS_REQUIRED
[[ -z "$DEBS_CONFLICTING" ]] || \
$SHORT_APTGET -q remove $DEBS_CONFLICTING
;;
*)
bad_os_id_ver
;;
esac

install_fuse_overlayfs_from_git

echo "Installing common tooling"
#make install.tools
4 changes: 3 additions & 1 deletion hack/get_ci_vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ delvm() {
}

image_hints() {
_BIS=$(egrep -m 1 '_BUILT_IMAGE_SUFFIX:[[:space:]+"[[:print:]]+"' \
"$STORAGEROOT/.cirrus.yml" | cut -d: -f 2 | tr -d '"[:blank:]')
egrep '[[:space:]]+[[:alnum:]].+_CACHE_IMAGE_NAME:[[:space:]+"[[:print:]]+"' \
"$STORAGEROOT/.cirrus.yml" | cut -d: -f 2 | tr -d '"[:blank:]' | \
grep -v 'notready' | sort -u
sed -r -e "s/\\\$[{]_BUILT_IMAGE_SUFFIX[}]/$_BIS/" | sort -u
}

show_usage() {
Expand Down

0 comments on commit 7c898fa

Please sign in to comment.