Commit d392f147 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Group similar builds

parent 1d548869
......@@ -95,6 +95,10 @@ class CommitStatus < ActiveRecord::Base
pipeline.before_sha || Gitlab::Git::BLANK_SHA
end
def group_name
name.gsub(/\d+[\s:]+\d+\s*/, '')
end
def self.stages
# We group by stage name, but order stages by theirs' index
unscoped.from(all, :sg).group('stage').order('max(stage_idx)', 'stage').pluck('sg.stage')
......
......@@ -39,8 +39,13 @@
= stage.titleize
.builds-container
%ul
- statuses.each do |status|
- status_groups = statuses.group_by(&:group_name)
- status_groups.each do |group_name, grouped_statuses|
- if grouped_statuses.one?
- status = grouped_statuses.first
= render "projects/#{status.to_partial_path}_pipeline", subject: status
- else
= render "projects/commit/pipeline_grouped_status", name: group_name, subject: grouped_statuses
- if pipeline.yaml_errors.present?
......
%li.build
.curve
.build-content
- group_status = CommitStatus.where(id: subject).status
= render_status_with_link('build', group_status)
%span.ci-status-text
= name
= subject.length
// Access all other grouped statuses
//- subject.each do |status|
// = render "projects/#{status.to_partial_path}_pipeline", subject: status
......@@ -3,9 +3,13 @@ class Gitlab::Seeder::Pipelines
BUILDS = [
{ name: 'build:linux', stage: 'build', status: :success },
{ name: 'build:osx', stage: 'build', status: :success },
{ name: 'rspec:linux', stage: 'test', status: :success },
{ name: 'rspec:windows', stage: 'test', status: :success },
{ name: 'rspec:windows', stage: 'test', status: :success },
{ name: 'rspec:linux 0 3', stage: 'test', status: :success },
{ name: 'rspec:linux 1 3', stage: 'test', status: :success },
{ name: 'rspec:linux 2 3', stage: 'test', status: :success },
{ name: 'rspec:windows 0 3', stage: 'test', status: :success },
{ name: 'rspec:windows 1 3', stage: 'test', status: :success },
{ name: 'rspec:windows 2 3', stage: 'test', status: :success },
{ name: 'rspec:windows 2 3', stage: 'test', status: :success },
{ name: 'rspec:osx', stage: 'test', status_event: :success },
{ name: 'spinach:linux', stage: 'test', status: :success },
{ name: 'spinach:osx', stage: 'test', status: :failed, allow_failure: true},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment