[libvirt PATCH 05/11] ci: util: Add new get_registry_images() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 ci/util.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/ci/util.py b/ci/util.py
index b6a99ce9c0..b314ebd078 100644
--- a/ci/util.py
+++ b/ci/util.py
@@ -72,6 +72,34 @@ def get_image_info(image_name: str) -> Dict[str, str]:
     return {"distro": distro, "cross": cross}
 
 
+def get_registry_images(registry_uri: str) -> Dict[str, List[str]]:
+    """
+    List all container images that are currently available in the
+    given GitLab project.
+
+    The returned dictionary contains an entry for each available
+    distro, with its associated value being a (possibly empty) list
+    of cross-building architectures it supports.
+
+    :param uri: URI pointing to a GitLab instance's image registry
+    :return: information about container images
+    """
+
+    registry_images = get_registry_images_raw(registry_uri)
+
+    # Parse the names of all images found on the registry and
+    # organize them by distro
+    images = {}
+    for image in registry_images:
+        info = get_image_info(image["name"])
+        if info["distro"] not in images:
+            images[info["distro"]] = []
+        if info["cross"]:
+            images[info["distro"]].append(info["cross"])
+
+    return images
+
+
 def get_registry_stale_images(registry_uri: str,
                               supported_distros: List[str]) -> Dict[str, int]:
     """
-- 
2.26.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux