summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/runner.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/runner.rb b/lib/runner.rb
index c856d3a..8a07030 100644
--- a/lib/runner.rb
+++ b/lib/runner.rb
@@ -15,10 +15,12 @@ class Runner
return true if @build.canceled?
- if @project.no_running_builds?
- run
- else
- run_later
+ run_in_transaction ? run : run_later
+ end
+
+ def run_in_transaction
+ ActiveRecord::Base.transaction do
+ build.run! if project.no_running_builds?
end
end
@@ -37,8 +39,6 @@ class Runner
commands = commands.lines.to_a
commands.unshift(prepare_project_cmd(path, build.sha))
- build.run!
-
Dir.chdir(path) do
commands.each do |line|
status = command(line, path)
@@ -91,7 +91,7 @@ class Runner
@process.environment['CI_SERVER_REVISION'] = GitlabCi::Revision
@process.environment['CI_BUILD_REF'] = build.ref
-
+
@process.start
build.set_file @tmp_file.path