Or we could simply ignore skipped manual jobs

This commit is contained in:
Lin Jen-Shin 2016-09-30 18:38:36 +08:00
parent 6053acf5e6
commit f3b02b9e6e
2 changed files with 7 additions and 2 deletions

View file

@ -21,7 +21,7 @@ module HasStatus
deduce_status = "(CASE
WHEN (#{builds})=(#{created}) THEN 'created'
WHEN (#{builds})=(#{skipped}) THEN 'success'
WHEN (#{builds})=(#{skipped}) THEN 'skipped'
WHEN (#{builds})=(#{success})+(#{ignored})+(#{skipped}) THEN 'success'
WHEN (#{builds})=(#{created})+(#{pending})+(#{skipped}) THEN 'pending'
WHEN (#{builds})=(#{canceled})+(#{success})+(#{ignored})+(#{skipped}) THEN 'canceled'

View file

@ -61,7 +61,12 @@ module Ci
end
def status_for_prior_stages(index)
pipeline.builds.where('stage_idx < ?', index).latest.status || 'success'
quoted_when = pipeline.builds.connection.quote_column_name('when')
pipeline.builds.
where('stage_idx < ?', index).
# We want to ignore skipped manual jobs
where("#{quoted_when} <> ? OR status <> ?", 'manual', 'skipped').
latest.status || 'success'
end
def stage_indexes_of_created_builds