diff options
author | Steve Azzopardi <steveazz@outlook.com> | 2018-09-06 13:21:58 +0300 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-09-13 18:31:52 +0300 |
commit | c80abb40fcb3b2dc35c62aa30d374f2889247746 (patch) | |
tree | 6f966cd0fa0d3f6f9c139c89d00f00e1de873ce6 /app/serializers | |
parent | c7d1eef671dbf598814a6c2ff1f81b924583ae8a (diff) |
Add retried jobs to pipeline stages
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/50461
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/stage_entity.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/serializers/stage_entity.rb b/app/serializers/stage_entity.rb index ca8fa7e7877..029dd3d0684 100644 --- a/app/serializers/stage_entity.rb +++ b/app/serializers/stage_entity.rb @@ -19,6 +19,12 @@ class StageEntity < Grape::Entity latest_statuses end + expose :retried, + if: -> (_, opts) { opts[:retried] }, + with: JobEntity do |stage| + retried_statuses + end + expose :detailed_status, as: :status, with: DetailedStatusEntity expose :path do |stage| @@ -48,9 +54,19 @@ class StageEntity < Grape::Entity @grouped_statuses ||= stage.statuses.latest_ordered.group_by(&:status) end + def grouped_retried_statuses + @grouped_retried_statuses ||= stage.statuses.retried_ordered.group_by(&:status) + end + def latest_statuses HasStatus::ORDERED_STATUSES.map do |ordered_status| grouped_statuses.fetch(ordered_status, []) end.flatten end + + def retried_statuses + HasStatus::ORDERED_STATUSES.map do |ordered_status| + grouped_retried_statuses.fetch(ordered_status, []) + end.flatten + end end |