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

Rename needs to bridge_needs internally

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