Skip to content
Snippets Groups Projects
Commit 1ae797c2 authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Fix create_next_builds method

parent ac50f9dd
Branches
Tags
2 merge requests!4779Test/#123 Master,!3653Ci::Commit becomes a Pipeline object
Pipeline #
Loading
@@ -116,12 +116,12 @@ module Ci
Loading
@@ -116,12 +116,12 @@ module Ci
next_stages.delete(build.stage) next_stages.delete(build.stage)
   
# get status for all prior builds # get status for all prior builds
prior_builds = latest_builds.reject { |other_build| next_stages.include?(other_build.stage) } prior_builds = latest_builds.where.not(stage: next_stages)
status = prior_builds.status prior_status = prior_builds.status
   
# create builds for next stages based # create builds for next stages based
next_stages.any? do |stage| next_stages.any? do |stage|
CreateBuildsService.new(self).execute(stage, build.user, status, build.trigger_request).present? CreateBuildsService.new(self).execute(stage, build.user, prior_status, build.trigger_request).present?
end end
end end
   
Loading
Loading
module Ci
class Status
def self.get_status(statuses)
if statuses.none?
'skipped'
elsif statuses.all? { |status| status.success? || status.ignored? }
'success'
elsif statuses.all?(&:pending?)
'pending'
elsif statuses.any?(&:running?) || statuses.any?(&:pending?)
'running'
elsif statuses.all?(&:canceled?)
'canceled'
else
'failed'
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment