summaryrefslogtreecommitdiff
path: root/app/models/ci/build.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-13 12:58:25 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-13 12:58:25 +0200
commit204fdcb1abb9c76b2d4bd6260c6e5ce91529aeb8 (patch)
tree0e62bd21453b627ae74139c985cd0faec623479b /app/models/ci/build.rb
parentfafc5a1777484ba6b1b12c5e88f3fc783fb4d839 (diff)
downloadgitlab-ce-204fdcb1abb9c76b2d4bd6260c6e5ce91529aeb8.tar.gz
Add build success worker that runs asynchronously
Diffstat (limited to 'app/models/ci/build.rb')
-rw-r--r--app/models/ci/build.rb21
1 files changed, 9 insertions, 12 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index b0d13c1bf06..ff70f3deb52 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -76,25 +76,22 @@ module Ci
state_machine :status do
after_transition pending: :running do |build|
- build.run_after_commit { BuildHooksWorker.perform_async(id) }
+ build.run_after_commit do
+ BuildHooksWorker.perform_async(id)
+ end
end
after_transition any => [:success, :failed, :canceled] do |build|
build.update_coverage
- build.run_after_commit { BuildHooksWorker.perform_async(id) }
+
+ build.run_after_commit do
+ BuildHooksWorker.perform_async(id)
+ end
end
after_transition any => [:success] do |build|
- if build.environment.present?
- service = CreateDeploymentService.new(
- build.project, build.user,
- environment: build.environment,
- sha: build.sha,
- ref: build.ref,
- tag: build.tag,
- options: build.options.to_h[:environment],
- variables: build.variables)
- service.execute(build)
+ build.run_after_commit do
+ BuildSuccessWorker.perform_async(id)
end
end
end