Commit 03bf8ef1 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'revert-upstream-pipeline-creation-failure' into 'master'

Revert upstream pipeline creation failure

Closes #205705

See merge request gitlab-org/gitlab!25308
parents 35c478de b8e5f77a
...@@ -214,7 +214,7 @@ module Ci ...@@ -214,7 +214,7 @@ module Ci
end end
end end
after_transition created: any - [:failed] do |pipeline| after_transition created: :pending do |pipeline|
next unless pipeline.bridge_triggered? next unless pipeline.bridge_triggered?
next if pipeline.bridge_waiting? next if pipeline.bridge_waiting?
......
...@@ -18,7 +18,7 @@ module Ci ...@@ -18,7 +18,7 @@ module Ci
current_user, current_user,
pipeline_params.fetch(:target_revision)) pipeline_params.fetch(:target_revision))
downstream_pipeline = service.execute( service.execute(
pipeline_params.fetch(:source), pipeline_params[:execute_params]) do |pipeline| pipeline_params.fetch(:source), pipeline_params[:execute_params]) do |pipeline|
@bridge.sourced_pipelines.build( @bridge.sourced_pipelines.build(
source_pipeline: @bridge.pipeline, source_pipeline: @bridge.pipeline,
...@@ -28,10 +28,6 @@ module Ci ...@@ -28,10 +28,6 @@ module Ci
pipeline.variables.build(@bridge.downstream_variables) pipeline.variables.build(@bridge.downstream_variables)
end end
downstream_pipeline.tap do |pipeline|
@bridge.drop!(:downstream_pipeline_creation_failed) if pipeline.errors.any?
end
end end
private private
......
---
title: Drop bridge on any downstream pipeline errors
merge_request: 24735
author:
type: fixed
---
title: Fix upstream bridge stuck when downstream pipeline is not pending
merge_request: 24665
author:
type: fixed
---
title: Fail upstream bridge on downstream pipeline creation failure.
merge_request: 24092
author:
type: fixed
...@@ -2932,30 +2932,6 @@ describe Ci::Pipeline, :mailer do ...@@ -2932,30 +2932,6 @@ describe Ci::Pipeline, :mailer do
create(:ci_sources_pipeline, pipeline: pipeline, source_job: bridge) create(:ci_sources_pipeline, pipeline: pipeline, source_job: bridge)
end end
context 'when downstream pipeline status transitions to pending' do
it 'updates bridge status ' do
expect(pipeline).to receive(:update_bridge_status!).once
pipeline.run!
end
end
context 'when the status of downstream pipeline transitions to waiting_for_resource' do
it 'updates bridge status ' do
expect(pipeline).to receive(:update_bridge_status!).once
pipeline.request_resource!
end
end
context 'when the status of downstream pipeline transitions to failed' do
it 'does not update bridge status ' do
expect(pipeline).not_to receive(:update_bridge_status!)
pipeline.drop!
end
end
describe '#bridge_triggered?' do describe '#bridge_triggered?' do
it 'is a pipeline triggered by a bridge' do it 'is a pipeline triggered by a bridge' do
expect(pipeline).to be_bridge_triggered expect(pipeline).to be_bridge_triggered
......
...@@ -267,34 +267,6 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do ...@@ -267,34 +267,6 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
end end
end end
context 'when downstream pipeline creation errors out' do
let(:stub_config) { false }
before do
stub_ci_pipeline_yaml_file(YAML.dump(invalid: { yaml: 'error' }))
end
it 'creates only one new pipeline' do
expect { service.execute(bridge) }
.to change { Ci::Pipeline.count }.by(1)
end
it 'creates a new pipeline in the downstream project' do
pipeline = service.execute(bridge)
expect(pipeline.user).to eq bridge.user
expect(pipeline.project).to eq downstream_project
end
it 'drops the bridge' do
pipeline = service.execute(bridge)
expect(pipeline.reload).to be_failed
expect(bridge.reload).to be_failed
expect(bridge.failure_reason).to eq('downstream_pipeline_creation_failed')
end
end
context 'when bridge job has YAML variables defined' do context 'when bridge job has YAML variables defined' do
before do before do
bridge.yaml_variables = [{ key: 'BRIDGE', value: 'var', public: true }] bridge.yaml_variables = [{ key: 'BRIDGE', value: 'var', public: true }]
......
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