since v2:
- dropped original patch 1 renaming ci-help to help in Makefile
- changed the --quiet cmdline option to be tied to the refresh cmd only
- urrlib imports fixed
- improved on Python type hinting
- improved util functions docstrings
- replaced all tabs in formatted strings with 4 spaces
- moved the list_stale_images method to util as requested
- renamed variables in list_stale_images so that it's more clear at first
glance what they actually hold
- added a hint on where GitLab personal tokens should be generated
- added a patch converting private method naming to reflect the common
Python practice (I did it in a separate patch so that if this is not
accepted I only need to ditch a single patch with no further changes)
v1:
https://listman.redhat.com/archives/libvir-list/2021-February/msg00641.ht=
ml
v2:
https://listman.redhat.com/archives/libvir-list/2021-March/msg00789.html
EXAMPLE OUTPUT OF THE REGISTRY CHECKER:
The following images can be purged from the registry:
ci-debian-9: (ID: 1154661)
ci-debian-9-cross-aarch64: (ID: 1154667)
ci-debian-9-cross-mipsel: (ID: 1154669)
ci-debian-9-cross-armv7l: (ID: 1154671)
ci-debian-9-cross-armv6l: (ID: 1154676)
ci-debian-9-cross-mips: (ID: 1154678)
ci-debian-9-cross-ppc64le: (ID: 1154682)
ci-debian-9-cross-s390x: (ID: 1154683)
ci-debian-9-cross-mips64el: (ID: 1154686)
ci-fedora-31: (ID: 1154687)
ci-opensuse-151: (ID: 1154724)
You can remove the above images over the API with the following code snippet:
$ for image_id in 1154661 1154667 1154669 1154671 1154676 1154678 1154682=
\
1154683 1154686 1154687 1154724; do \
curl --request DELETE --header "PRIVATE-TOKEN: <access_token>"
\
https://gitlab.com/api/v4/projects/libvirt%2Flibvirt/registry/repos=
itories/$image_id \
done
You can generate a personal access token here:
https://gitlab.com/-/profile/personal_access_tokens
Erik Skultety (6):
ci: helper: Use the ArgumentDefaultsHelpFormatter help formatter
ci: helper: Introduce --quiet
ci: Introduce a util module
ci: helper: Rewrite image listing to Python
ci: util: Add a registry checker for stale images
ci: helper: Convert private methods to Python common naming practice
ci/Makefile | 12 ----
ci/helper | 162 ++++++++++++++++++++++++++++++++++++----------
ci/list-images.sh | 14 ----
ci/util.py | 92 ++++++++++++++++++++++++++
4 files changed, 219 insertions(+), 61 deletions(-)
delete mode 100644 ci/list-images.sh
create mode 100644 ci/util.py
--=20
2.29.2