diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-18 22:36:54 +0100 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-18 22:36:54 +0100 |
commit | 71db3b1ce7abe992dedd60d15e614efff7cb2109 (patch) | |
tree | c179a15564763db9be5398a270a040370474594a /app/models | |
parent | 62e2989bb77ea91f3e0acc81d8720eeaebb6bfd4 (diff) | |
download | gitlab-ce-71db3b1ce7abe992dedd60d15e614efff7cb2109.tar.gz |
Make all future skipped builds as processable when retrying a build
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 1 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/models/commit_status.rb | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 3d6c6ea3209..d96a55ad34e 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -62,6 +62,7 @@ module Ci status_event: 'enqueue' ) MergeRequests::AddTodoWhenBuildFailsService.new(build.project, nil).close(new_build) + build.pipeline.mark_as_processable_after_stage(build.stage_idx) new_build end end diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 8cfba92ae9b..6b4fb0fa794 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -136,6 +136,10 @@ module Ci end end + def mark_as_processable_after_stage(stage_idx) + builds.skipped.where('stage_idx > ?', stage_idx).each(&:process) + end + def latest? return false unless ref commit = project.commit(ref) diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 703ca90edb6..110dcd7369d 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -30,6 +30,10 @@ class CommitStatus < ActiveRecord::Base transition [:created, :skipped] => :pending end + event :process do + transition skipped: :created + end + event :run do transition pending: :running end |