From 1be0fd9a4cbe91a99d37d2b9a298d600bebd7147 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Nov 26 2024 22:04:56 +0000 Subject: Log a more useful message when a manifest arch is missing When we don't publish a multi-arch manifest because an arch that's present in the current published version of that manifest was not present in the compose we're working on, the message we log doesn't give you any indication which compose or manifest we were working on, which makes it hard to debug the problem. Let's make that better! Signed-off-by: Adam Williamson --- diff --git a/fedora-image-uploader/fedora_image_uploader/handler.py b/fedora-image-uploader/fedora_image_uploader/handler.py index 48d0ecf..ca1858f 100644 --- a/fedora-image-uploader/fedora_image_uploader/handler.py +++ b/fedora-image-uploader/fedora_image_uploader/handler.py @@ -297,8 +297,11 @@ class Uploader: missing = self._missing_manifest_arches(firstregref, builtarches) if missing: _log.error( - "Arches %s in current manifest were not built, not publishing manifest", + "Arches %s in current manifest %s were not built in compose %s, " + "not publishing manifest", " ".join(missing), + firstregref, + ffrel.cid, ) # we assume all registries always have the same # content, so if we hit this failure, just return diff --git a/fedora-image-uploader/tests/test_handler.py b/fedora-image-uploader/tests/test_handler.py index be7dbf8..b4af15d 100644 --- a/fedora-image-uploader/tests/test_handler.py +++ b/fedora-image-uploader/tests/test_handler.py @@ -53,6 +53,7 @@ from fedora_image_uploader.handler import _run [ ( "messages/rawhide_compose.json", + "Fedora-Rawhide-20240910.n.0", "Rawhide-20240910.n.0", "42", "rawhide", @@ -69,6 +70,7 @@ from fedora_image_uploader.handler import _run ), ( "messages/rc_compose.json", + "Fedora-40-20240414.0", "40-1.14", "40", "latest", @@ -85,6 +87,7 @@ from fedora_image_uploader.handler import _run ), ( "messages/eln_compose.json", + "Fedora-eln-20240919.n.1", "11-20240919.n.1", "11", "latest", @@ -103,7 +106,7 @@ def test_containers( # the single-image manifests we just pushed when creating the # multi-arch manifest mock_subrun.return_value.stdout = '{"somejson": "something"}' - message_file, cidorlabel, relnum, alias, milestone, expected_images = compose + message_file, cid, fnver, relnum, alias, milestone, expected_images = compose # mapping of reponames to expected image filename base strings repotoid = { "eln": "Fedora-ELN-Container-Base-Generic", @@ -173,14 +176,14 @@ def test_containers( ident = repotoid[exprepo] if "Container" in ident: if milestone != "eln" and int(relnum) < 41: - expfn = f"oci-archive:/test/{ident}.{arch}-{cidorlabel}.oci.tar" + expfn = f"oci-archive:/test/{ident}.{arch}-{fnver}.oci.tar" else: - expfn = f"oci-archive:/test/{ident}-{cidorlabel}.{arch}.oci.tar" + expfn = f"oci-archive:/test/{ident}-{fnver}.{arch}.oci.tar" else: # atomic desktop filenames don't have the arch and # use a non-standard compose label representation # https://gitlab.com/fedora/ostree/sig/-/issues/31 - expfn = f"oci-archive:/test/{ident}-{cidorlabel.replace('-', '.')}.ociarchive" + expfn = f"oci-archive:/test/{ident}-{fnver.replace('-', '.')}.ociarchive" expcall = f"skopeo copy {expfn} docker://{registry}/{exprepo}:{maintag}-{arch}" assert expcall in runcalls runcalls.remove(expcall) @@ -240,10 +243,9 @@ def test_containers( runcalls = [" ".join(call.args[0]) for call in mock_subrun.call_args_list] assert all("skopeo inspect" not in call for call in runcalls) assert all("skopeo copy oci:" not in call for call in runcalls) - assert ( - caplog.records[-1].getMessage() - == "Arches x86_64 in current manifest were not built, not publishing manifest" - ) + msg = caplog.records[-1].getMessage() + assert msg.startswith("Arches x86_64 in current manifest") + assert msg.endswith(f"were not built in compose {cid}, not publishing manifest") @pytest.mark.vcr