Commit 7c55c671 authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-same-family-pipeline-ids' into 'master'

Use an array for fetching same_family_pipeline_ids

See merge request gitlab-org/gitlab!36883
parents 8b38b1c9 ad5f50a3
......@@ -819,15 +819,8 @@ module Ci
# If pipeline is a child of another pipeline, include the parent
# and the siblings, otherwise return only itself and children.
def same_family_pipeline_ids
if (parent = parent_pipeline)
Ci::Pipeline.where(id: parent.id)
.or(Ci::Pipeline.where(id: parent.child_pipelines.select(:id)))
.select(:id)
else
Ci::Pipeline.where(id: self.id)
.or(Ci::Pipeline.where(id: self.child_pipelines.select(:id)))
.select(:id)
end
parent = parent_pipeline || self
[parent.id] + parent.child_pipelines.pluck(:id)
end
def bridge_triggered?
......
---
title: Use an array for fetching same_family_pipeline_ids
merge_request: 36883
author:
type: fixed
......@@ -2684,7 +2684,7 @@ RSpec.describe Ci::Pipeline, :mailer do
context 'when pipeline is not child nor parent' do
it 'returns just the pipeline id' do
expect(same_family_pipeline_ids).to contain_exactly(pipeline)
expect(same_family_pipeline_ids).to contain_exactly(pipeline.id)
end
end
......@@ -2707,7 +2707,7 @@ RSpec.describe Ci::Pipeline, :mailer do
end
it 'returns parent sibling and self ids' do
expect(same_family_pipeline_ids).to contain_exactly(parent, pipeline, sibling)
expect(same_family_pipeline_ids).to contain_exactly(parent.id, pipeline.id, sibling.id)
end
end
......@@ -2723,7 +2723,7 @@ RSpec.describe Ci::Pipeline, :mailer do
end
it 'returns self and child ids' do
expect(same_family_pipeline_ids).to contain_exactly(pipeline, child)
expect(same_family_pipeline_ids).to contain_exactly(pipeline.id, child.id)
end
end
end
......
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