Commit e3507c92 authored by Dylan Griffith's avatar Dylan Griffith

Add inverse_of: :pipeline for pipeline.builds (#37987)

This appears to reduce the number of queries in pipeline creation of
gitlab-ce's .gitlab-ci.yml by 92

This also means we now need to mock this ci yaml file properly in the
test because otherwise the yaml_errors stay on the object and make all
the pipelines failed.
parent 59de0443
...@@ -14,7 +14,7 @@ module Ci ...@@ -14,7 +14,7 @@ module Ci
has_many :stages has_many :stages
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id, inverse_of: :pipeline
has_many :builds, foreign_key: :commit_id has_many :builds, foreign_key: :commit_id, inverse_of: :pipeline
has_many :trigger_requests, dependent: :destroy, foreign_key: :commit_id # rubocop:disable Cop/ActiveRecordDependent has_many :trigger_requests, dependent: :destroy, foreign_key: :commit_id # rubocop:disable Cop/ActiveRecordDependent
has_many :variables, class_name: 'Ci::PipelineVariable' has_many :variables, class_name: 'Ci::PipelineVariable'
......
...@@ -9,6 +9,8 @@ describe Ci::ProcessPipelineService, '#execute' do ...@@ -9,6 +9,8 @@ describe Ci::ProcessPipelineService, '#execute' do
end end
before do before do
stub_ci_pipeline_to_return_yaml_file
stub_not_protect_default_branch stub_not_protect_default_branch
project.add_developer(user) project.add_developer(user)
......
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