Commit 5f67bf74 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve CI builds fixtures

parent ff2d1dd2
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
project = Project.first Project.all.sample(5).each do |project|
commits = project.repository.commits('master', nil, 10) commits = project.repository.commits('master', nil, 10)
commits_sha = commits.map { |commit| commit.raw.id } commits_sha = commits.map { |commit| commit.raw.id }
ci_commits = commits_sha.map do |sha| ci_commits = commits_sha.map do |sha|
...@@ -7,6 +7,19 @@ Gitlab::Seeder.quiet do ...@@ -7,6 +7,19 @@ Gitlab::Seeder.quiet do
end end
ci_commits.each do |ci_commit| ci_commits.each do |ci_commit|
ci_commit.create_builds('master', nil, User.first) attributes = { type: 'Ci::Build', name: 'test build',
commands: "$ build command", stage: 'test',
stage_idx: 1, ref: 'master', user_id: User.first,
gl_project_id: project.id, options: '---- opts',
status: %w(running pending success failed canceled).sample,
commit_id: ci_commit.id }
begin
Ci::Build.create!(attributes)
print '.'
rescue ActiveRecord::RecordInvalid
print 'F'
end
end
end end
end end
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