[libvirt PATCH 06/11] ci: helper: Use get_registry_images()

Andrea Bolognani abologna at redhat.com
Fri Apr 23 15:03:03 UTC 2021


Generate output using the processed data instead of the raw
data.

The output remains identical for now, so this doesn't look
like a big improvement, but we're soon going to change it in
a way that highlights the convenience of using processed data.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 ci/helper | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/ci/helper b/ci/helper
index eb037d3495..c1e1a53d51 100755
--- a/ci/helper
+++ b/ci/helper
@@ -309,15 +309,18 @@ class Application:
     def _action_list_images(self):
         registry_uri = util.get_registry_uri(self._args.namespace,
                                              self._args.gitlab_uri)
-        images = util.get_registry_images_raw(registry_uri)
-
-        # skip the "ci-" prefix each of our container images' name has
-        name_prefix = "ci-"
-        names = [i["name"][len(name_prefix):] for i in images]
-        names.sort()
-
-        native = [name for name in names if "-cross-" not in name]
-        cross = [name for name in names if "-cross-" in name]
+        images = util.get_registry_images(registry_uri)
+
+        native = []
+        cross = []
+        for image_distro in images.keys():
+            if images[image_distro]:
+                for image_cross in images[image_distro]:
+                    cross.append(image_distro + "-cross-" + image_cross)
+            else:
+                native.append(image_distro)
+        native.sort()
+        cross.sort()
 
         spacing = 4 * " "
         print("Available x86 container images:\n")
-- 
2.26.3




More information about the libvir-list mailing list