diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 09:08:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-05 09:08:45 +0300 |
commit | 34cd22d1a925bd4113e10279bbf98db28adff420 (patch) | |
tree | 4f1f99638abe7ce84ba311325b60d14922cc1847 /app/workers/deployments | |
parent | d0bb8e50e2f4f1943e4d81b9024c9b3efac4275e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers/deployments')
-rw-r--r-- | app/workers/deployments/execute_hooks_worker.rb | 17 | ||||
-rw-r--r-- | app/workers/deployments/link_merge_request_worker.rb | 18 | ||||
-rw-r--r-- | app/workers/deployments/success_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/deployments/update_environment_worker.rb | 20 |
4 files changed, 56 insertions, 1 deletions
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/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..ff1b2d80c1a 100644 --- a/app/workers/deployments/success_worker.rb +++ b/app/workers/deployments/success_worker.rb @@ -12,7 +12,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 |