diff options
Diffstat (limited to 'app/models/ci/bridge.rb')
-rw-r--r-- | app/models/ci/bridge.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb index abd59741e89..3726c05acd8 100644 --- a/app/models/ci/bridge.rb +++ b/app/models/ci/bridge.rb @@ -25,6 +25,14 @@ module Ci # rubocop:enable Cop/ActiveRecordSerialize state_machine :status do + after_transition created: :pending do |bridge| + next unless bridge.downstream_project + + bridge.run_after_commit do + bridge.schedule_downstream_pipeline! + end + end + event :manual do transition all => :manual end @@ -38,6 +46,12 @@ module Ci raise NotImplementedError end + def schedule_downstream_pipeline! + raise InvalidBridgeTypeError unless downstream_project + + ::Ci::CreateCrossProjectPipelineWorker.perform_async(self.id) + end + def inherit_status_from_downstream!(pipeline) case pipeline.status when 'success' |