gitlab-org--gitlab-foss/db/fixtures/development/14_builds.rb

26 lines
855 B
Ruby
Raw Normal View History

2015-12-16 09:13:34 -05:00
Gitlab::Seeder.quiet do
2015-12-16 13:07:27 -05:00
Project.all.sample(5).each do |project|
commits = project.repository.commits('master', nil, 10)
commits_sha = commits.map { |commit| commit.raw.id }
ci_commits = commits_sha.map do |sha|
project.ensure_ci_commit(sha)
end
ci_commits.each do |ci_commit|
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 }
2015-12-16 09:13:34 -05:00
2015-12-16 13:07:27 -05:00
begin
Ci::Build.create!(attributes)
print '.'
rescue ActiveRecord::RecordInvalid
print 'F'
end
end
2015-12-16 09:13:34 -05:00
end
end