提交 22fd7df0 编写于 作者: S Shinya Maeda

Simplify the Deployable and BuildSuccessWorker

上级 41108959
...@@ -7,7 +7,7 @@ module Deployable ...@@ -7,7 +7,7 @@ module Deployable
after_create :create_deployment after_create :create_deployment
def create_deployment def create_deployment
return unless has_environment? && !has_deployment? return unless has_environment?
environment = project.environments.find_or_create_by( environment = project.environments.find_or_create_by(
name: expanded_environment_name name: expanded_environment_name
......
...@@ -22,6 +22,8 @@ class BuildSuccessWorker ...@@ -22,6 +22,8 @@ class BuildSuccessWorker
# Therefore we no longer need to create a deployment, after a build succeeded. # Therefore we no longer need to create a deployment, after a build succeeded.
# We're leaving this code for the transition period, but we can remove this code in 11.6. # We're leaving this code for the transition period, but we can remove this code in 11.6.
def create_deployment(build) def create_deployment(build)
return if build.has_deployment?
build.create_deployment.try do |deployment| build.create_deployment.try do |deployment|
deployment.succeed deployment.succeed
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册