Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2015-12-16 21:07:27 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 14:48:12 +0300
commit5f67bf74f460c9dd1e9061757a23a2bdf447fca3 (patch)
treec9d9f4c2974e6705ddaf9091154f66e53fe7d99e /db
parentff2d1dd2e87b067336bc7e373662fd05f494f14d (diff)
Improve CI builds fixtures
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/14_builds.rb29
1 files changed, 21 insertions, 8 deletions
diff --git a/db/fixtures/development/14_builds.rb b/db/fixtures/development/14_builds.rb
index ac3bd1e9d63..73cffcbc01e 100644
--- a/db/fixtures/development/14_builds.rb
+++ b/db/fixtures/development/14_builds.rb
@@ -1,12 +1,25 @@
Gitlab::Seeder.quiet do
- project = Project.first
- 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
+ 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 }
- ci_commits.each do |ci_commit|
- ci_commit.create_builds('master', nil, User.first)
+ begin
+ Ci::Build.create!(attributes)
+ print '.'
+ rescue ActiveRecord::RecordInvalid
+ print 'F'
+ end
+ end
end
end