Commit 63759af3 authored by Matija Čupić's avatar Matija Čupić

Rename needs to bridge_needs internally

parent 45ebde4d
......@@ -99,7 +99,7 @@ module EE
def upstream_project
strong_memoize(:upstream_project) do
options&.dig(:needs, :pipeline)
options&.dig(:bridge_needs, :pipeline)
end
end
......
......@@ -39,7 +39,7 @@ describe Ci::Bridge do
context 'when bridge points towards upstream' do
before do
bridge.options = { needs: { pipeline: 'my/project' } }
bridge.options = { bridge_needs: { pipeline: 'my/project' } }
end
it 'subscribes to the upstream project' do
......
......@@ -77,7 +77,7 @@ describe Ci::SubscribeBridgeService do
let(:upstream_project) { nil }
before do
bridge.options = { needs: { pipeline: 'some/project' } }
bridge.options = { bridge_needs: { pipeline: 'some/project' } }
end
it 'drops the bridge' do
......
......@@ -41,7 +41,8 @@ module Gitlab
def bridge?
attributes_hash = @attributes.to_h
attributes_hash.dig(:options, :trigger).present? ||
attributes_hash.dig(:options, :needs, :pipeline).present?
(attributes_hash.dig(:options, :bridge_needs).instance_of?(Hash) &&
attributes_hash.dig(:options, :bridge_needs, :pipeline).present?)
end
def to_resource
......
......@@ -56,7 +56,7 @@ module Gitlab
instance: job[:instance],
start_in: job[:start_in],
trigger: job[:trigger],
needs: job[:needs]
bridge_needs: job[:needs]
}.compact }.compact
end
......
......@@ -30,7 +30,7 @@ FactoryBot.define do
if evaluator.upstream.present?
bridge.options = bridge.options.to_h.merge(
needs: { pipeline: evaluator.upstream.full_path }
bridge_needs: { pipeline: evaluator.upstream.full_path }
)
end
end
......
......@@ -37,14 +37,14 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
context 'when job is an upstream bridge' do
let(:attributes) do
{ name: 'rspec', ref: 'master', options: { needs: { pipeline: 'my/project' } } }
{ name: 'rspec', ref: 'master', options: { bridge_needs: { pipeline: 'my/project' } } }
end
it { is_expected.to be_truthy }
context 'when upstream definition is empty' do
let(:attributes) do
{ name: 'rspec', ref: 'master', options: { needs: { pipeline: '' } } }
{ name: 'rspec', ref: 'master', options: { bridge_needs: { pipeline: '' } } }
end
it { is_expected.to be_falsey }
......
......@@ -1153,7 +1153,10 @@ module Gitlab
stage_idx: 1,
name: "test1",
options: {
script: ["test"]
script: ["test"],
# This does not make sense, there is a follow-up:
# https://gitlab.com/gitlab-org/gitlab-ce/issues/65569
bridge_needs: %w[build1 build2]
},
needs_attributes: [
{ name: "build1" },
......
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