Skip to content
Snippets Groups Projects
Commit 85f0b3a9 authored by Felipe Artur's avatar Felipe Artur
Browse files

Add merge requests association to pipeline

parent 4ae411ff
No related branches found
No related tags found
2 merge requests!12073Add RC2 changes to 9-3-stable,!10064Preloads head pipeline for each merge request
Loading
Loading
@@ -17,6 +17,7 @@ module Ci
has_many :statuses, class_name: 'CommitStatus', foreign_key: :commit_id
has_many :builds, foreign_key: :commit_id
has_many :trigger_requests, dependent: :destroy, foreign_key: :commit_id
has_many :merge_requests, foreign_key: "head_pipeline_id"
 
has_many :pending_builds, -> { pending }, foreign_key: :commit_id, class_name: 'Ci::Build'
has_many :retryable_builds, -> { latest.failed_or_canceled }, foreign_key: :commit_id, class_name: 'Ci::Build'
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@ require 'spec_helper'
 
describe PipelineMetricsWorker do
let(:project) { create(:project, :repository) }
let!(:merge_request) { create(:merge_request, source_project: project, source_branch: pipeline.ref) }
let!(:merge_request) { create(:merge_request, source_project: project, source_branch: pipeline.ref, head_pipeline_id: pipeline.id) }
 
let(:pipeline) do
create(:ci_empty_pipeline,
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment