Commit cce2fc9d authored by Michael Kozono's avatar Michael Kozono

Merge branch 'fix-docker-registry-replication' into 'master'

[Geo][Registry Replication] Fix the source of notification secret for omnibus

See merge request gitlab-org/gitlab-ee!15891
parents 1c80f114 a5466229
......@@ -9,8 +9,7 @@ module API
resource :container_registry_event do
helpers do
def authenticate_registry_notification!
endpoint = Gitlab.config.registry.notifications.find { |e| e['name'] == 'geo_event'}
secret_token = endpoint['headers']['Authorization']
secret_token = Gitlab.config.registry.notification_secret
unauthorized! unless Devise.secure_compare(secret_token, headers['Authorization'])
end
......
......@@ -9,10 +9,7 @@ describe API::ContainerRegistryEvent do
describe 'POST /container_registry_event/events' do
before do
stub_registry_endpoints_configuration([{
name: 'geo_event',
headers: { 'Authorization' => secret_token }
}.with_indifferent_access])
allow(Gitlab.config.registry).to receive(:notification_secret) { secret_token }
end
it 'returns 200 status and events are passed to event handler' do
......@@ -34,9 +31,5 @@ describe API::ContainerRegistryEvent do
expect(response.status).to eq 401
end
def stub_registry_endpoints_configuration(configuration)
allow(Gitlab.config.registry).to receive(:notifications) { configuration }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment