2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-10 08:25:49 -05:00
|
|
|
FactoryBot.define do
|
2020-01-09 13:07:52 -05:00
|
|
|
factory :ci_bridge, class: 'Ci::Bridge' do
|
2019-10-01 20:06:26 -04:00
|
|
|
name { 'bridge' }
|
|
|
|
stage { 'test' }
|
|
|
|
stage_idx { 0 }
|
|
|
|
ref { 'master' }
|
|
|
|
tag { false }
|
|
|
|
created_at { 'Di 29. Okt 09:50:00 CET 2013' }
|
|
|
|
status { :created }
|
2018-12-10 08:25:49 -05:00
|
|
|
|
|
|
|
pipeline factory: :ci_pipeline
|
|
|
|
|
2019-01-28 06:49:15 -05:00
|
|
|
trait :variables do
|
2019-10-01 20:06:26 -04:00
|
|
|
yaml_variables do
|
|
|
|
[{ key: 'BRIDGE', value: 'cross', public: true }]
|
|
|
|
end
|
2019-01-28 06:49:15 -05:00
|
|
|
end
|
|
|
|
|
2019-10-01 20:06:26 -04:00
|
|
|
transient do
|
|
|
|
downstream { nil }
|
|
|
|
upstream { nil }
|
|
|
|
end
|
2019-01-22 09:05:44 -05:00
|
|
|
|
2018-12-10 08:25:49 -05:00
|
|
|
after(:build) do |bridge, evaluator|
|
|
|
|
bridge.project ||= bridge.pipeline.project
|
2019-01-22 09:05:44 -05:00
|
|
|
|
|
|
|
if evaluator.downstream.present?
|
|
|
|
bridge.options = bridge.options.to_h.merge(
|
|
|
|
trigger: { project: evaluator.downstream.full_path }
|
|
|
|
)
|
|
|
|
end
|
2019-07-31 11:36:57 -04:00
|
|
|
|
|
|
|
if evaluator.upstream.present?
|
|
|
|
bridge.options = bridge.options.to_h.merge(
|
|
|
|
bridge_needs: { pipeline: evaluator.upstream.full_path }
|
|
|
|
)
|
|
|
|
end
|
2018-12-10 08:25:49 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|