Fix create_next_builds method
This commit is contained in:
parent
ac50f9dddf
commit
1ae797c229
2 changed files with 3 additions and 22 deletions
|
@ -116,12 +116,12 @@ module Ci
|
|||
next_stages.delete(build.stage)
|
||||
|
||||
# get status for all prior builds
|
||||
prior_builds = latest_builds.reject { |other_build| next_stages.include?(other_build.stage) }
|
||||
status = prior_builds.status
|
||||
prior_builds = latest_builds.where.not(stage: next_stages)
|
||||
prior_status = prior_builds.status
|
||||
|
||||
# create builds for next stages based
|
||||
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
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
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
|
Loading…
Reference in a new issue