diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 09:07:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 09:07:58 +0000 |
commit | 45b4df3e57c949c88107840c44ccbfaf2eabdf26 (patch) | |
tree | f73c1533a75b03d2ceb1361644e0d8ab97568a8f /lib | |
parent | 7421e6f9f2b5889b05738af7eba568af6ae3fcbc (diff) | |
download | gitlab-ce-45b4df3e57c949c88107840c44ccbfaf2eabdf26.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/api.rb | 1 | ||||
-rw-r--r-- | lib/api/container_registry_event.rb | 43 | ||||
-rw-r--r-- | lib/gitlab/hook_data/issue_builder.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/import_export/fast_hash_serializer.rb | 7 | ||||
-rw-r--r-- | lib/gitlab/import_export/legacy_relation_tree_saver.rb | 10 |
5 files changed, 49 insertions, 13 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 02b3fe7e03e..bc333880bbd 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -121,6 +121,7 @@ module API mount ::API::BroadcastMessages mount ::API::Commits mount ::API::CommitStatuses + mount ::API::ContainerRegistryEvent mount ::API::DeployKeys mount ::API::DeployTokens mount ::API::Deployments diff --git a/lib/api/container_registry_event.rb b/lib/api/container_registry_event.rb new file mode 100644 index 00000000000..6d93cc65336 --- /dev/null +++ b/lib/api/container_registry_event.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module API + class ContainerRegistryEvent < Grape::API + DOCKER_DISTRIBUTION_EVENTS_V1_JSON = 'application/vnd.docker.distribution.events.v1+json' + + before { authenticate_registry_notification! } + + resource :container_registry_event do + helpers do + def authenticate_registry_notification! + secret_token = Gitlab.config.registry.notification_secret + + unauthorized! unless Devise.secure_compare(secret_token, headers['Authorization']) + end + end + + # Docker Registry sends data in a body of the request as JSON string, + # by setting 'content_type' we make Grape to parse it automatically + content_type :json, DOCKER_DISTRIBUTION_EVENTS_V1_JSON + format :json + + params do + requires :events, type: Array + end + + # This endpoint is used by Docker Registry to push a set of event + # that took place recently. + post 'events' do + params['events'].each do |raw_event| + event = ::ContainerRegistry::Event.new(raw_event) + + if event.supported? + event.handle! + event.track! + end + end + + status :ok + end + end + end +end diff --git a/lib/gitlab/hook_data/issue_builder.rb b/lib/gitlab/hook_data/issue_builder.rb index 9d9db6cf94f..f38012c9804 100644 --- a/lib/gitlab/hook_data/issue_builder.rb +++ b/lib/gitlab/hook_data/issue_builder.rb @@ -17,6 +17,7 @@ module Gitlab confidential created_at description + discussion_locked due_date id iid diff --git a/lib/gitlab/import_export/fast_hash_serializer.rb b/lib/gitlab/import_export/fast_hash_serializer.rb index c6ecf13ded8..c5fb00ed741 100644 --- a/lib/gitlab/import_export/fast_hash_serializer.rb +++ b/lib/gitlab/import_export/fast_hash_serializer.rb @@ -142,12 +142,7 @@ module Gitlab # returned by database when no `ORDER` is specified batch = batch.reorder(batch.klass.primary_key) - if Feature.enabled?(:export_fast_serialize_with_raw_json, default_enabled: true) - data.append(JSONBatchRelation.new(batch, options, preloads[key]).tap(&:raw_json)) - else - batch = batch.preload(preloads[key]) if preloads&.key?(key) - data += batch.as_json(options) - end + data.append(JSONBatchRelation.new(batch, options, preloads[key]).tap(&:raw_json)) end data diff --git a/lib/gitlab/import_export/legacy_relation_tree_saver.rb b/lib/gitlab/import_export/legacy_relation_tree_saver.rb index fe3e64358e5..cf75a2c7fa8 100644 --- a/lib/gitlab/import_export/legacy_relation_tree_saver.rb +++ b/lib/gitlab/import_export/legacy_relation_tree_saver.rb @@ -6,13 +6,9 @@ module Gitlab include Gitlab::ImportExport::CommandLineUtil def serialize(exportable, relations_tree) - if Feature.enabled?(:export_fast_serialize, default_enabled: true) - Gitlab::ImportExport::FastHashSerializer - .new(exportable, relations_tree) - .execute - else - exportable.as_json(relations_tree) - end + Gitlab::ImportExport::FastHashSerializer + .new(exportable, relations_tree) + .execute end def save(tree, dir_path, filename) |