2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
FactoryBot.define do
|
2020-03-09 13:42:32 +05:30
|
|
|
factory :ci_bridge, class: 'Ci::Bridge' do
|
2019-12-21 20:55:43 +05:30
|
|
|
name { 'bridge' }
|
|
|
|
stage { 'test' }
|
|
|
|
stage_idx { 0 }
|
|
|
|
ref { 'master' }
|
|
|
|
tag { false }
|
|
|
|
created_at { 'Di 29. Okt 09:50:00 CET 2013' }
|
|
|
|
status { :created }
|
2020-03-09 13:42:32 +05:30
|
|
|
scheduling_type { 'stage' }
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
pipeline factory: :ci_pipeline
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
trait :variables do
|
2019-12-21 20:55:43 +05:30
|
|
|
yaml_variables do
|
|
|
|
[{ key: 'BRIDGE', value: 'cross', public: true }]
|
|
|
|
end
|
2019-03-02 22:35:43 +05:30
|
|
|
end
|
|
|
|
|
2019-12-21 20:55:43 +05:30
|
|
|
transient do
|
|
|
|
downstream { nil }
|
|
|
|
upstream { nil }
|
|
|
|
end
|
2019-03-02 22:35:43 +05:30
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
after(:build) do |bridge, evaluator|
|
|
|
|
bridge.project ||= bridge.pipeline.project
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
if evaluator.downstream.present?
|
|
|
|
bridge.options = bridge.options.to_h.merge(
|
|
|
|
trigger: { project: evaluator.downstream.full_path }
|
|
|
|
)
|
|
|
|
end
|
2019-10-12 21:52:04 +05:30
|
|
|
|
|
|
|
if evaluator.upstream.present?
|
|
|
|
bridge.options = bridge.options.to_h.merge(
|
|
|
|
bridge_needs: { pipeline: evaluator.upstream.full_path }
|
|
|
|
)
|
|
|
|
end
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|