mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
ci: Avoid use of magic constants
The value 3 is the length of the "ci-" prefix, which is present in the items returned by get_registry_images() but not in those returned by get_dockerfiles(). Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Beraldo Leal <bleal@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a4b00fd2b1
commit
4ba191f7e5
@ -68,10 +68,11 @@ def get_registry_stale_images(registry_uri: str, base_dir: str) -> Dict[str, int
|
||||
|
||||
dockerfiles = get_dockerfiles(base_dir)
|
||||
images = get_registry_images(registry_uri)
|
||||
name_prefix = "ci-"
|
||||
|
||||
stale_images = {}
|
||||
for img in images:
|
||||
if img["name"][3:] not in dockerfiles:
|
||||
if img["name"][len(name_prefix):] not in dockerfiles:
|
||||
stale_images[img["name"]] = img["id"]
|
||||
|
||||
return stale_images
|
||||
|
Loading…
Reference in New Issue
Block a user