Skip to content

tools/ci-fairy: fix delete-image not retrieving all repositories

Íñigo Huguet requested to merge ihuguet/ci-templates:fix_delete_image into master

If the number of repositories is high, Gitlab pagination may limit to 20 repositories per page. In that case, ci-fairy was getting a partial list and deleted images only for those repositories. Even specifying --repository it had the same effect.

Pass get_all=True to repositories.list() so the full list of repositories is retrieved.

Without the fix, a warning message is printed if you are getting a partial list: UserWarning: Calling a list() method without specifying get_all=True or iterator=True will return a maximum of 20 items. Your query returned 20 of 42 items. See https://python-gitlab.readthedocs.io/en/v3.14.0/api-usage.html#pagination for more details. If this was done intentionally, then this warning can be supressed by adding the argument get_all=False to the list() call. (python-gitlab: /usr/lib/python3.12/site-packages/gitlab/client.py:976) r for r in p.repositories.list() if repository is None or repository == r.name

Merge request reports