diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/workers/deployments | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/workers/deployments')
-rw-r--r-- | app/workers/deployments/drop_older_deployments_worker.rb | 14 | ||||
-rw-r--r-- | app/workers/deployments/execute_hooks_worker.rb | 17 | ||||
-rw-r--r-- | app/workers/deployments/finished_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/deployments/forward_deployment_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/deployments/link_merge_request_worker.rb | 18 | ||||
-rw-r--r-- | app/workers/deployments/success_worker.rb | 4 | ||||
-rw-r--r-- | app/workers/deployments/update_environment_worker.rb | 20 |
7 files changed, 76 insertions, 1 deletions
diff --git a/app/workers/deployments/drop_older_deployments_worker.rb b/app/workers/deployments/drop_older_deployments_worker.rb new file mode 100644 index 00000000000..d6cd92c1da4 --- /dev/null +++ b/app/workers/deployments/drop_older_deployments_worker.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Deployments + class DropOlderDeploymentsWorker # rubocop:disable Scalability/IdempotentWorker + include ApplicationWorker + + queue_namespace :deployment + feature_category :continuous_delivery + + def perform(deployment_id) + Deployments::OlderDeploymentsDropService.new(deployment_id).execute + end + end +end diff --git a/app/workers/deployments/execute_hooks_worker.rb b/app/workers/deployments/execute_hooks_worker.rb new file mode 100644 index 00000000000..6be05232321 --- /dev/null +++ b/app/workers/deployments/execute_hooks_worker.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Deployments + class ExecuteHooksWorker # rubocop:disable Scalability/IdempotentWorker + include ApplicationWorker + + queue_namespace :deployment + feature_category :continuous_delivery + worker_resource_boundary :cpu + + def perform(deployment_id) + if (deploy = Deployment.find_by_id(deployment_id)) + deploy.execute_hooks + end + end + end +end diff --git a/app/workers/deployments/finished_worker.rb b/app/workers/deployments/finished_worker.rb index 0be420af718..62c886010a3 100644 --- a/app/workers/deployments/finished_worker.rb +++ b/app/workers/deployments/finished_worker.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +# This worker is deprecated and will be removed in 14.0 +# See: https://gitlab.com/gitlab-org/gitlab/-/issues/266381 module Deployments class FinishedWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker diff --git a/app/workers/deployments/forward_deployment_worker.rb b/app/workers/deployments/forward_deployment_worker.rb index a6f246dbbbd..dd01fcbbafe 100644 --- a/app/workers/deployments/forward_deployment_worker.rb +++ b/app/workers/deployments/forward_deployment_worker.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +# This worker is deprecated and will be removed in 14.0 +# See: https://gitlab.com/gitlab-org/gitlab/-/issues/266381 module Deployments class ForwardDeploymentWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker diff --git a/app/workers/deployments/link_merge_request_worker.rb b/app/workers/deployments/link_merge_request_worker.rb new file mode 100644 index 00000000000..4723691a0bb --- /dev/null +++ b/app/workers/deployments/link_merge_request_worker.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Deployments + class LinkMergeRequestWorker + include ApplicationWorker + + queue_namespace :deployment + idempotent! + feature_category :continuous_delivery + worker_resource_boundary :cpu + + def perform(deployment_id) + if (deploy = Deployment.find_by_id(deployment_id)) + LinkMergeRequestsService.new(deploy).execute + end + end + end +end diff --git a/app/workers/deployments/success_worker.rb b/app/workers/deployments/success_worker.rb index 17f790d2f6f..b72b107985b 100644 --- a/app/workers/deployments/success_worker.rb +++ b/app/workers/deployments/success_worker.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +# This worker is deprecated and will be removed in 14.0 +# See: https://gitlab.com/gitlab-org/gitlab/-/issues/266381 module Deployments class SuccessWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker @@ -12,7 +14,7 @@ module Deployments Deployment.find_by_id(deployment_id).try do |deployment| break unless deployment.success? - Deployments::AfterCreateService.new(deployment).execute + Deployments::UpdateEnvironmentService.new(deployment).execute end end end diff --git a/app/workers/deployments/update_environment_worker.rb b/app/workers/deployments/update_environment_worker.rb new file mode 100644 index 00000000000..2381f9926bc --- /dev/null +++ b/app/workers/deployments/update_environment_worker.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Deployments + class UpdateEnvironmentWorker + include ApplicationWorker + + queue_namespace :deployment + idempotent! + feature_category :continuous_delivery + worker_resource_boundary :cpu + + def perform(deployment_id) + Deployment.find_by_id(deployment_id).try do |deployment| + break unless deployment.success? + + Deployments::UpdateEnvironmentService.new(deployment).execute + end + end + end +end |