Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 15:09:17 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 15:09:17 +0300
commitcd52759ee33051b8ad7b88b02ba7954e4fad7018 (patch)
treef1096c68e457aef7f5201acd16e4a751ff538026 /app/workers
parent18f7828977b74bf6e5153594a098ef90e773b3b7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/all_queues.yml7
-rw-r--r--app/workers/authorized_keys_worker.rb29
-rw-r--r--app/workers/gitlab_shell_worker.rb10
3 files changed, 46 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml
index 71f7c1bac3c..81c09a77730 100644
--- a/app/workers/all_queues.yml
+++ b/app/workers/all_queues.yml
@@ -843,6 +843,13 @@
:resource_boundary: :unknown
:weight: 1
:idempotent:
+- :name: authorized_keys
+ :feature_category: :source_code_management
+ :has_external_dependencies:
+ :urgency: :high
+ :resource_boundary: :unknown
+ :weight: 2
+ :idempotent: true
- :name: authorized_projects
:feature_category: :authentication_and_authorization
:has_external_dependencies:
diff --git a/app/workers/authorized_keys_worker.rb b/app/workers/authorized_keys_worker.rb
new file mode 100644
index 00000000000..b2333033e56
--- /dev/null
+++ b/app/workers/authorized_keys_worker.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class AuthorizedKeysWorker
+ include ApplicationWorker
+
+ PERMITTED_ACTIONS = [:add_key, :remove_key].freeze
+
+ feature_category :source_code_management
+ urgency :high
+ weight 2
+ idempotent!
+
+ def perform(action, *args)
+ return unless Gitlab::CurrentSettings.authorized_keys_enabled?
+
+ case action
+ when :add_key
+ authorized_keys.add_key(*args)
+ when :remove_key
+ authorized_keys.remove_key(*args)
+ end
+ end
+
+ private
+
+ def authorized_keys
+ @authorized_keys ||= Gitlab::AuthorizedKeys.new
+ end
+end
diff --git a/app/workers/gitlab_shell_worker.rb b/app/workers/gitlab_shell_worker.rb
index ed08069d2bc..0db794793d4 100644
--- a/app/workers/gitlab_shell_worker.rb
+++ b/app/workers/gitlab_shell_worker.rb
@@ -9,6 +9,16 @@ class GitlabShellWorker # rubocop:disable Scalability/IdempotentWorker
weight 2
def perform(action, *arg)
+ # Gitlab::Shell is being removed but we need to continue to process jobs
+ # enqueued in the previous release, so handle them here.
+ #
+ # See https://gitlab.com/gitlab-org/gitlab/-/issues/25095 for more details
+ if AuthorizedKeysWorker::PERMITTED_ACTIONS.include?(action)
+ AuthorizedKeysWorker.new.perform(action, *arg)
+
+ return
+ end
+
Gitlab::GitalyClient::NamespaceService.allow do
gitlab_shell.__send__(action, *arg) # rubocop:disable GitlabSecurity/PublicSend
end