Skip to content

Geo: Container Repository push events don't work

Problem

When a docker push on the primary site is happening, the registry fires a notification to /api/v4/container_registry_event/events endpoint. Now it's broken because the endpoint returns HTTP 400 error. It got broken after merging 56a6638b. When I applied the following change, it started to accept the requests:


diff --git a/lib/api/container_registry_event.rb b/lib/api/container_registry_event.rb
index 9e59401d..268d7390 100644
--- a/lib/api/container_registry_event.rb
+++ b/lib/api/container_registry_event.rb
@@ -33,16 +33,7 @@ def authenticate_registry_notification!
         tags %w[container_registry_event]
       end
       params do
-        requires :events, type: Array, desc: 'Event notifications' do
-          requires :action, type: String, desc: 'The action to perform, `push`, `delete`',
-                            values: %w[push delete].freeze
-          optional :target, type: Hash, desc: 'The target of the action' do
-            optional :tag, type: String, desc: 'The target tag', documentation: { example: 'latest' }
-            optional :repository, type: String, desc: 'The target repository', documentation: { example: 'group/p1' }
-            optional :digest, type: String, desc: 'Unique identifier for target image manifest',
-                              documentation: { example: 'imagedigest' }
-          end
-        end
+        requires :events, type: Array
       end

Impact

Affected GitLab versions 15.6, 15.7. The new containers will be synced by the backfill worker but the existing ones won't be ever updated after a new push and the status will be shown as "synced".

Definition of done

Edited by Valery Sizov