diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 13:30:49 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-07-17 13:30:49 +0200 |
commit | 63137d4e5bd8e42d5b95ffac44be71f998148494 (patch) | |
tree | 967a00a0f27f31c7a091b541b8d3f1e4bbfda4a6 /app | |
parent | a4d301eed047afb800b810432680b8c9134fa40a (diff) | |
download | gitlab-ce-63137d4e5bd8e42d5b95ffac44be71f998148494.tar.gz |
Add specs for pipeline process with auto-retries
This also resolve a possible race condition - a next stage should not
start until are retries are done in a previous one.
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index a1b1fbefa42..416a2a33378 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -97,13 +97,11 @@ module Ci end end - after_transition any => [:failed] do |build| - build.run_after_commit do - next if build.retries_max.zero? + before_transition any => [:failed] do |build| + next if build.retries_max.zero? - if build.retries_count < build.retries_max - Ci::Build.retry(build, build.user) - end + if build.retries_count < build.retries_max + Ci::Build.retry(build, build.user) end end end |