我如何找出谁将图像推送到 Gitlab 容器注册表

How can I find out who pushed an image to the Gitlab Container registry

我想找出谁/什么用户将图像推送到 Gitlab 容器注册表。最好使用 gitlab-python 包。 当使用 gitlab-python 包时,我能够得到对象 'ProjectRegistryRepository'。但是,这并没有向我显示任何可能导致执行推送的人的属性。

对象的示例输出 'ProjectRegistryRepository':

{'id': 1589, 'name': 'python-test-image', 'path': 'repo-name/python-test-image', 'project_id': 8433, 'location': 'dockerhublocation', 'created_at': '2022-03-11T09:45:19.071Z', 'cleanup_policy_started_at': None}

此信息未由 API 公开。您无法从 API 确定推送图像的用户。

然而,这是一个planned feature to include container registry events in Audit Events and Audit Events API

如果您使用的是 self-hosted GitLab 实例,您可以通过分析实例的访问日志来确定谁推送了图像。