Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-19 21:35:07 +0300
committerRuben Davila <rdavila84@gmail.com>2016-08-19 23:30:37 +0300
commit594f938927d273f637a68c4bb5e3271f689d17b6 (patch)
treecfe699893f3047656599461f46551b62af267c1a /app
parent5482327989b63701dcb5d4a3ee106841450cfa59 (diff)
Merge branch 'mark-as-processable' into 'master'
Make all future skipped builds as processable when retrying a build ## What does this MR do? Makes a builds that are marked as skipped when a pipeline is processed to be reprocessed by changing their's state to created. ## Why was this MR needed? Currently retry is broken. When you retry a build of pipeline it will succeed and be marked as succeeded, when the next stages should be triggered. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21066 See merge request !5879
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/build.rb1
-rw-r--r--app/models/ci/pipeline.rb4
-rw-r--r--app/models/commit_status.rb4
3 files changed, 9 insertions, 0 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 096280ab617..2ea2b8a8a40 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 c3d22933683..81afa892e49 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -140,6 +140,10 @@ module Ci
end
end
+ def mark_as_processable_after_stage(stage_idx)
+ builds.skipped.where('stage_idx > ?', stage_idx).find_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