summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-07-23 07:34:22 +0000
committerLin Jen-Shin <godfat@godfat.org>2019-07-23 07:34:22 +0000
commit9eb467645f227231cfe905d1c4ba651ac4645ab6 (patch)
tree6788496302eeb04ad2100e08fb172023e14e2d1e
parentd9de7234fc19f3a5188ec35adb7f3d25fd12272b (diff)
parent6331ddbe56a30b230935995d1daf644761f154eb (diff)
downloadgitlab-ce-9eb467645f227231cfe905d1c4ba651ac4645ab6.tar.gz
Merge branch 'rs-fixtures-parity' into 'master'
CE-EE parity for pipelines development fixture See merge request gitlab-org/gitlab-ce!30870
-rw-r--r--db/fixtures/development/14_pipelines.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb
index db043e39d2c..05bda7d3672 100644
--- a/db/fixtures/development/14_pipelines.rb
+++ b/db/fixtures/development/14_pipelines.rb
@@ -79,9 +79,17 @@ class Gitlab::Seeder::Pipelines
def create_master_pipelines
@project.repository.commits('master', limit: 4).map do |commit|
- create_pipeline!(@project, 'master', commit)
+ create_pipeline!(@project, 'master', commit).tap do |pipeline|
+ random_pipeline.tap do |triggered_by_pipeline|
+ triggered_by_pipeline.try(:sourced_pipelines)&.create(
+ source_job: triggered_by_pipeline.builds.all.sample,
+ source_project: triggered_by_pipeline.project,
+ project: pipeline.project,
+ pipeline: pipeline)
+ end
+ end
end
- rescue
+ rescue ActiveRecord::ActiveRecordError
[]
end
@@ -98,7 +106,7 @@ class Gitlab::Seeder::Pipelines
end
pipelines.flatten
- rescue
+ rescue ActiveRecord::ActiveRecordError
[]
end
@@ -231,6 +239,10 @@ class Gitlab::Seeder::Pipelines
@project.team.users.sample
end
+ def random_pipeline
+ Ci::Pipeline.limit(4).all.sample
+ end
+
def build_status
Ci::Build::AVAILABLE_STATUSES.sample
end