diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-08-17 19:49:42 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2016-08-17 19:49:42 +0300 |
commit | eefb2582f45d9946de4a4b78cf8bcdc86085a1e0 (patch) | |
tree | bd58eb9aae91b847336f4b55bb0c3278e78ab084 /db | |
parent | b3b503b5cd1a502e85e412dbe6fa9efe28dc66f9 (diff) | |
parent | 62e2989bb77ea91f3e0acc81d8720eeaebb6bfd4 (diff) |
Merge branch '18681-pipelines-merge-request' into 'master'
Resolve "Pipelines for merge request"
## What does this MR do?
Adds `Pipelines` tab in merge request view
## What are the relevant issue numbers?
Closes #18681
## Screenshots (if relevant)
![Screen_Shot_2016-08-16_at_3.22.41_PM](/uploads/c04febab3765b1fac2bf3bbfb9882f9f/Screen_Shot_2016-08-16_at_3.22.41_PM.png)
See merge request !5485
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/14_builds.rb | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/db/fixtures/development/14_builds.rb b/db/fixtures/development/14_builds.rb index 6441a036e75..0d493fa1c3c 100644 --- a/db/fixtures/development/14_builds.rb +++ b/db/fixtures/development/14_builds.rb @@ -26,24 +26,44 @@ class Gitlab::Seeder::Builds begin BUILDS.each { |opts| build_create!(pipeline, opts) } commit_status_create!(pipeline, name: 'jenkins', status: :success) - print '.' rescue ActiveRecord::RecordInvalid print 'F' + ensure + pipeline.build_updated end end end def pipelines - commits = @project.repository.commits('master', limit: 5) - commits_sha = commits.map { |commit| commit.raw.id } - commits_sha.map do |sha| - @project.ensure_pipeline(sha, 'master') - end + master_pipelines + merge_request_pipelines + end + + def master_pipelines + create_pipelines_for(@project, 'master') rescue [] end + def merge_request_pipelines + @project.merge_requests.last(5).map do |merge_request| + create_pipelines(merge_request.source_project, merge_request.source_branch, merge_request.commits.last(5)) + end.flatten + rescue + [] + end + + def create_pipelines_for(project, ref) + commits = project.repository.commits(ref, limit: 5) + create_pipelines(project, ref, commits) + end + + def create_pipelines(project, ref, commits) + commits.map do |commit| + project.pipelines.create(sha: commit.id, ref: ref) + end + end + def build_create!(pipeline, opts = {}) attributes = build_attributes_for(pipeline, opts) |