diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-06-26 12:48:48 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-06-26 12:48:48 +0300 |
commit | 4503240abdd9a38e801aef49edad9ff9c7f9457d (patch) | |
tree | 801f974ef54782e0cb7a7d5dd6373749dcd30e1a /app/models | |
parent | 07f6ab2b5339e3db171b6b53c972e1bdf17dffc9 (diff) | |
parent | caf6b9918e3f7a79c9ffcffd1880f29422d50eb5 (diff) |
Merge branch 'fix/gb/fix-skipped-pipeline-with-allowed-to-fail-jobs' into 'master'
Fix pipeline status when allowed to fail jobs present
Closes #29059
See merge request !11166
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/has_status.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index 3c9c6584e02..32af5566135 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -11,18 +11,21 @@ module HasStatus class_methods do def status_sql - scope = respond_to?(:exclude_ignored) ? exclude_ignored : all - - builds = scope.select('count(*)').to_sql - created = scope.created.select('count(*)').to_sql - success = scope.success.select('count(*)').to_sql - manual = scope.manual.select('count(*)').to_sql - pending = scope.pending.select('count(*)').to_sql - running = scope.running.select('count(*)').to_sql - skipped = scope.skipped.select('count(*)').to_sql - canceled = scope.canceled.select('count(*)').to_sql + scope_relevant = respond_to?(:exclude_ignored) ? exclude_ignored : all + scope_warnings = respond_to?(:failed_but_allowed) ? failed_but_allowed : none + + builds = scope_relevant.select('count(*)').to_sql + created = scope_relevant.created.select('count(*)').to_sql + success = scope_relevant.success.select('count(*)').to_sql + manual = scope_relevant.manual.select('count(*)').to_sql + pending = scope_relevant.pending.select('count(*)').to_sql + running = scope_relevant.running.select('count(*)').to_sql + skipped = scope_relevant.skipped.select('count(*)').to_sql + canceled = scope_relevant.canceled.select('count(*)').to_sql + warnings = scope_warnings.select('count(*) > 0').to_sql.presence || 'false' "(CASE + WHEN (#{builds})=(#{skipped}) AND (#{warnings}) THEN 'success' WHEN (#{builds})=(#{skipped}) THEN 'skipped' WHEN (#{builds})=(#{success}) THEN 'success' WHEN (#{builds})=(#{created}) THEN 'created' |