2019-07-25 01:11:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-10 08:25:49 -05:00
|
|
|
FactoryBot.define do
|
2021-02-05 04:09:10 -05:00
|
|
|
factory :ci_bridge, class: 'Ci::Bridge', parent: :ci_processable do
|
2019-10-01 20:06:26 -04:00
|
|
|
name { 'bridge' }
|
2020-04-21 11:21:10 -04:00
|
|
|
created_at { '2013-10-29 09:50:00 CET' }
|
2019-10-01 20:06:26 -04:00
|
|
|
status { :created }
|
2018-12-10 08:25:49 -05:00
|
|
|
|
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
|
2020-04-21 11:21:10 -04:00
|
|
|
|
2020-10-13 05:08:27 -04:00
|
|
|
trait :created do
|
|
|
|
status { 'created' }
|
|
|
|
end
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
trait :started do
|
|
|
|
started_at { '2013-10-29 09:51:28 CET' }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :finished do
|
|
|
|
started
|
|
|
|
finished_at { '2013-10-29 09:53:28 CET' }
|
|
|
|
end
|
|
|
|
|
2021-01-27 04:09:01 -05:00
|
|
|
trait :success do
|
|
|
|
finished
|
|
|
|
status { 'success' }
|
|
|
|
end
|
|
|
|
|
2020-04-21 11:21:10 -04:00
|
|
|
trait :failed do
|
|
|
|
finished
|
|
|
|
status { 'failed' }
|
|
|
|
end
|
2020-08-21 11:10:03 -04:00
|
|
|
|
|
|
|
trait :skipped do
|
|
|
|
started
|
|
|
|
status { 'skipped' }
|
|
|
|
end
|
2020-09-17 08:09:37 -04:00
|
|
|
|
|
|
|
trait :strategy_depend do
|
|
|
|
options { { trigger: { strategy: 'depend' } } }
|
|
|
|
end
|
2020-10-13 05:08:27 -04:00
|
|
|
|
|
|
|
trait :manual do
|
|
|
|
status { 'manual' }
|
|
|
|
self.when { 'manual' }
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :playable do
|
|
|
|
manual
|
|
|
|
end
|
2021-01-27 04:09:01 -05:00
|
|
|
|
|
|
|
trait :allowed_to_fail do
|
|
|
|
allow_failure { true }
|
|
|
|
end
|
2018-12-10 08:25:49 -05:00
|
|
|
end
|
|
|
|
end
|