Create audit event for container repository creation
What does this MR do and why?
Adds an audit event for a container repository being created in Gitlab via registry authentication.
Details
Adds a new option to ContainerRepository#find_or_create_by_path!
that returns whether the upserted repo path is a new record or not. This is required since the Rails upsert
method does not return this info with the result, and only new records should be audited.
Verification
- Start environment with container registry running
- Choose a project with a Dockerfile (or create one)
- Clone the project, build and push a container image - https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html
- Verify the repo was created under the project in the Deploy > Container Registry side menu
- Verify an audit event was created in the project's Secure > Audit Events
Related to #362290 (closed)
Edited by Aaron Huntsman