Commit 0ba90249 authored by Andy Soiron's avatar Andy Soiron

Merge branch...

Merge branch '344782-db-seed_fu-failure-nomethoderror-undefined-method-pipelines-for-vulnerabilities-finding' into 'master'

Don't add pipeline to Vulnerabilities::Finding

See merge request gitlab-org/gitlab!73614
parents c62ddb6e 0322f8f5
...@@ -12,14 +12,10 @@ class Gitlab::Seeder::Vulnerabilities ...@@ -12,14 +12,10 @@ class Gitlab::Seeder::Vulnerabilities
end end
def seed! def seed!
return unless pipeline
30.times do |rank| 30.times do |rank|
primary_identifier = create_identifier(rank) primary_identifier = create_identifier(rank)
vulnerability = create_vulnerability vulnerability = create_vulnerability
occurrence = create_occurrence(vulnerability, rank, primary_identifier) occurrence = create_occurrence(vulnerability, rank, primary_identifier)
# Create finding_pipeline join model
occurrence.pipelines << pipeline
# Create occurrence_identifier join models # Create occurrence_identifier join models
occurrence.identifiers << primary_identifier occurrence.identifiers << primary_identifier
occurrence.identifiers << create_identifier(rank) if rank % 3 == 0 occurrence.identifiers << create_identifier(rank) if rank % 3 == 0
...@@ -70,6 +66,7 @@ class Gitlab::Seeder::Vulnerabilities ...@@ -70,6 +66,7 @@ class Gitlab::Seeder::Vulnerabilities
scanner = FactoryBot.create(:vulnerabilities_scanner, project: vulnerability.project) scanner = FactoryBot.create(:vulnerabilities_scanner, project: vulnerability.project)
FactoryBot.create( FactoryBot.create(
:vulnerabilities_finding, :vulnerabilities_finding,
:with_pipeline,
project: project, project: project,
vulnerability: vulnerability, vulnerability: vulnerability,
scanner: scanner, scanner: scanner,
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# EE fixture # EE fixture
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
Project.not_mass_generated.sample(5).each do |project| Project.not_mass_generated.sample(5).each do |project|
project.ci_pipelines.all.sample(2).each do |pipeline| project.builds.sample(2).each do |build|
pipeline = build.pipeline
next if pipeline.source_pipeline next if pipeline.source_pipeline
target_pipeline = Ci::Pipeline target_pipeline = Ci::Pipeline
...@@ -15,7 +16,7 @@ Gitlab::Seeder.quiet do ...@@ -15,7 +16,7 @@ Gitlab::Seeder.quiet do
# link to source pipeline # link to source pipeline
pipeline.sourced_pipelines.create!( pipeline.sourced_pipelines.create!(
source_job: pipeline.builds.all.sample, source_job: pipeline.builds.sample,
source_project: pipeline.project, source_project: pipeline.project,
project: target_pipeline.project, project: target_pipeline.project,
pipeline: target_pipeline pipeline: target_pipeline
......
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