Update fixtures to make development testing easier
This commit is contained in:
parent
a2bf638e40
commit
bcb3937da8
|
@ -26,24 +26,44 @@ class Gitlab::Seeder::Builds
|
||||||
begin
|
begin
|
||||||
BUILDS.each { |opts| build_create!(pipeline, opts) }
|
BUILDS.each { |opts| build_create!(pipeline, opts) }
|
||||||
commit_status_create!(pipeline, name: 'jenkins', status: :success)
|
commit_status_create!(pipeline, name: 'jenkins', status: :success)
|
||||||
|
|
||||||
print '.'
|
print '.'
|
||||||
rescue ActiveRecord::RecordInvalid
|
rescue ActiveRecord::RecordInvalid
|
||||||
print 'F'
|
print 'F'
|
||||||
|
ensure
|
||||||
|
pipeline.build_updated
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pipelines
|
def pipelines
|
||||||
commits = @project.repository.commits('master', limit: 5)
|
master_pipelines + merge_request_pipelines
|
||||||
commits_sha = commits.map { |commit| commit.raw.id }
|
end
|
||||||
commits_sha.map do |sha|
|
|
||||||
@project.ensure_pipeline(sha, 'master')
|
def master_pipelines
|
||||||
end
|
create_pipelines_for(@project, 'master')
|
||||||
rescue
|
rescue
|
||||||
[]
|
[]
|
||||||
end
|
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 = {})
|
def build_create!(pipeline, opts = {})
|
||||||
attributes = build_attributes_for(pipeline, opts)
|
attributes = build_attributes_for(pipeline, opts)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue