From bf091abdc509ea03387f69f140de4d648a59ff72 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Thu, 8 Aug 2024 10:19:05 -0400 Subject: [PATCH 1/2] Fix not testing registry.conf updates Previously, if anyone touched these files no extra testing would trigger. However, basically all testing depends on them. Update the condition and test that verifies it. Signed-off-by: Chris Evich --- .cirrus.yml | 22 +++++++++++----------- contrib/cirrus/cirrus_yaml_test.py | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 03c0904577..cb45ef9d72 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -374,7 +374,7 @@ bindings_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('pkg/bindings/test/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: &build @@ -500,7 +500,7 @@ docker-py_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/python/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -527,7 +527,7 @@ unit_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('**/*_test.go') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -557,7 +557,7 @@ apiv2_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/apiv2/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -589,7 +589,7 @@ compose_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/compose/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -621,7 +621,7 @@ local_integration_test_task: &local_integration_test_task only_if: &only_if_int_test >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/e2e/**', 'test/utils/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -715,7 +715,7 @@ podman_machine_task: only_if: &only_if_machine_test >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('cmd/podman/machine/**', 'pkg/machine/**', '**/*machine*.go') depends_on: *build ec2_instance: @@ -838,7 +838,7 @@ local_system_test_task: &local_system_test_task only_if: &only_if_system_test >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/system/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -930,7 +930,7 @@ farm_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/farm/**', 'test/system/*.bash') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build @@ -954,7 +954,7 @@ buildah_bud_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('**/*build*.go', 'test/buildah-bud/**') depends_on: *build env: @@ -982,7 +982,7 @@ upgrade_test_task: only_if: >- $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || - changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || + changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || changesInclude('test/upgrade/**', 'test/system/*.bash') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build diff --git a/contrib/cirrus/cirrus_yaml_test.py b/contrib/cirrus/cirrus_yaml_test.py index 49b1a41954..f127ffbfa2 100755 --- a/contrib/cirrus/cirrus_yaml_test.py +++ b/contrib/cirrus/cirrus_yaml_test.py @@ -62,7 +62,10 @@ def test_depends(self): def test_only_if(self): """2024-07 PR#23174: ugly but necessary duplication in only_if conditions. Prevent typos or unwanted changes.""" - beginning = "$CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'hack/**', 'version/rawversion/*') || " + # N/B: This giant string is white space sensitive, take care when updating/modifying + beginning = ("$CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || changesInclude('.cirrus.yml'," + " 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf'," + " 'hack/**', 'version/rawversion/*') || ") real_source_changes = " || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**'))" for task_name in self.ALL_TASK_NAMES: From 7936809f75e2f88bd1d2e053bc227bee613c43ac Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 7 Aug 2024 11:58:49 -0400 Subject: [PATCH 2/2] Reduce python APIv2 test net dependency Previously these tests pulled some test images from quay, opening them up to networking-flake induced failures. As has already been done for other tests, update to utilize the locally running registry server. Also: Add `test/python/**` into the apiv2 task conditions as referenced by the `Makefile` `localapiv2-python` target. Signed-off-by: Chris Evich --- .cirrus.yml | 2 +- test/python/docker/__init__.py | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index cb45ef9d72..25201af5cb 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -558,7 +558,7 @@ apiv2_test_task: $CIRRUS_PR == '' || $CIRRUS_CHANGE_TITLE =~ '.*CI:ALL.*' || changesInclude('.cirrus.yml', 'Makefile', 'contrib/cirrus/**', 'vendor/**', 'test/tools/**', 'test/registries*.conf', 'hack/**', 'version/rawversion/*') || - changesInclude('test/apiv2/**') || + changesInclude('test/apiv2/**', 'test/python/**') || (changesInclude('**/*.go', '**/*.c', '**/*.h') && !changesIncludeOnly('test/**', 'pkg/machine/e2e/**')) depends_on: *build gce_instance: *standardvm diff --git a/test/python/docker/__init__.py b/test/python/docker/__init__.py index d46f465f79..78ff5c3725 100644 --- a/test/python/docker/__init__.py +++ b/test/python/docker/__init__.py @@ -44,17 +44,27 @@ def __init__(self): os.environ["CONTAINERS_REGISTRIES_CONF"] = os.path.join( self.anchor_directory, "registry.conf" ) - conf = """unqualified-search-registries = ["docker.io", "quay.io"] -[[registry]] -location="localhost:5000" -insecure=true + # Entry verified by compat/test_system.py + reg_conf_sfx = """ [[registry.mirror]] location = "mirror.localhost:5000" """ + # Assume developer-mode testing by default + reg_conf_source_path="./test/registries.conf" + + # When operating in a CI environment, use the local registry server. + # Ref: https://github.com/containers/automation_images/pull/357 + # https://github.com/containers/podman/pull/22726 + if os.getenv("CI_USE_REGISTRY_CACHE"): + reg_conf_source_path = "./test/registries-cached.conf" + + with open(os.path.join(reg_conf_source_path)) as file: + conf = file.read() + reg_conf_sfx + with open(os.environ["CONTAINERS_REGISTRIES_CONF"], "w") as file: file.write(conf)