CI: use local registry, part 1 of 3: setup

As of https://github.com/containers/automation_images/pull/357
our CI VMs include a local registry preloaded with all(*)
images used in tests.

 * where "all" means "most".

This commit installs a new registries.conf that redirects docker
and quay to the new local registry. The hope is that this will
reduce CI flakes.

Since tests change over time, and new tests may require new
images, this commit also adds a mechanism for pulling in
remote images at test run time. Obviously this negates
the purpose of the cache, since it introduces a flake
pain point. The idea is: DO NOT DO THIS UNLESS ABSOLUTELY
NECESSARY, and then, if we have to do this, hurry up and
spin new CI VMs that include the new image(s).

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2024-06-06 12:48:59 -06:00
parent 7cc9b41e3d
commit 2e8c074234
6 changed files with 84 additions and 2 deletions

View File

@ -33,7 +33,7 @@ env:
DEBIAN_NAME: "debian-13"
# Image identifiers
IMAGE_SUFFIX: "c20240702t180702z-f40f39d13"
IMAGE_SUFFIX: "c20240708t152000z-f40f39d13"
# EC2 images
FEDORA_AMI: "fedora-aws-${IMAGE_SUFFIX}"

View File

@ -72,6 +72,9 @@ CIRRUS_CI="${CIRRUS_CI:-false}"
CONTINUOUS_INTEGRATION="${CONTINUOUS_INTEGRATION:-false}"
CIRRUS_REPO_NAME=${CIRRUS_REPO_NAME:-podman}
# All CI jobs use a local registry
export CI_USE_REGISTRY_CACHE=true
# shellcheck disable=SC2154
if [[ -n "$CIRRUS_PR" ]] && [[ -z "$PR_BASE_SHA" ]]; then
# shellcheck disable=SC2154
@ -193,7 +196,8 @@ setup_rootless() {
install_test_configs() {
msg "Installing ./test/registries.conf system-wide."
install -v -D -m 644 ./test/registries.conf /etc/containers/
# All CI VMs run with a local registry
install -v -D -m 644 ./test/registries-cached.conf /etc/containers/registries.conf
}
# Remove all files provided by the distro version of podman.

View File

@ -335,6 +335,18 @@ case "$PODBIN_NAME" in
*) die_unknown PODBIN_NAME
esac
# As of July 2024, CI VMs come built-in with a registry.
LCR=/var/cache/local-registry/local-cache-registry
if [[ -x $LCR ]]; then
# Images in cache registry are prepopulated at the time
# VMs are built. If any PR adds a dependency on new images,
# those must be fetched now, at VM start time. This should
# be rare, and must be fixed in next automation_images build.
while read new_image; do
$LCR cache $new_image
done < <(grep '^[^#]' test/NEW-IMAGES || true)
fi
# Required to be defined by caller: The primary type of testing that will be performed
# shellcheck disable=SC2154
showrun echo "about to set up for TEST_FLAVOR [=$TEST_FLAVOR]"
@ -426,6 +438,10 @@ case "$TEST_FLAVOR" in
fi
remove_packaged_podman_files
showrun make install PREFIX=/usr ETCDIR=/etc
# machine-os image changes too frequently, can't be precached
# FIXME: I don't think we can use version.go, because of chicken-egg
# problem when that gets bumped. Ideas welcome.
$LCR cache podman/machine-os:5.2
install_test_configs
;;
swagger)

14
test/NEW-IMAGES Normal file
View File

@ -0,0 +1,14 @@
#
# As of July 2024, all CI VMs include a local registry prepopulated
# with all container images used in tests:
#
# https://github.com/containers/automation_images/pull/357
# https://github.com/containers/podman/pull/22726
#
# From time to time -- infrequently, we hope! -- existing images are
# updated, or tests are added that require new images. Those must be
# prefetched on each CI job, at least until new VMs are built. This
# file contains those images.
#
# Format is one FQIN per line. Enumerate them below:
#

View File

@ -0,0 +1,41 @@
#####
##### CAUTION! All changes to this file must also be
##### CAUTION! mirrored to registries.conf !
#####
##### This is the registries.conf file used IN DEVELOPER ENVIRONMENT.
##### For the one used in CI, see registries-cached.conf
#####
# Note that changing the order here may break tests.
unqualified-search-registries = ['docker.io', 'quay.io', 'registry.fedoraproject.org']
[[registry]]
# In Nov. 2020, Docker rate-limits image pulling. To avoid hitting these
# limits while testing, always use the google mirror for qualified and
# unqualified `docker.io` images.
# Ref: https://cloud.google.com/container-registry/docs/pulling-cached-images
prefix="docker.io"
location="127.0.0.1:60333"
insecure=true
[[registry]]
prefix="quay.io"
location="127.0.0.1:60333"
insecure=true
# 2020-10-27 a number of images are not present in gcr.io, and podman
# barfs spectacularly when trying to fetch them. We've hand-copied
# those to quay, using skopeo copy --all ...
[[registry]]
prefix="docker.io/library"
location="127.0.0.1:60333/libpod"
insecure=true
# For testing #11933 to make sure that registries.conf is consulted unless
# --tls-verify is used during container creation.
[[registry]]
location="localhost:5000"
insecure=true
# Alias used in tests.
[aliases]
"podman-desktop-test123"="florent.fr/will/like"

View File

@ -1,3 +1,10 @@
#####
##### CAUTION! All changes to this file must also be
##### CAUTION! mirrored to registries-cached.conf !
#####
##### This is the registries.conf file used IN DEVELOPER ENVIRONMENT.
##### For the one used in CI, see registries-cached.conf
#####
# Note that changing the order here may break tests.
unqualified-search-registries = ['docker.io', 'quay.io', 'registry.fedoraproject.org']