Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-09-05 12:56:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-09-05 12:56:47 +0300
commit50a34b230b390fbd0e65c79c3daf377bc0faa8e4 (patch)
treebc69edade1ee2f1948591da6cec87d4d7b3df93a
parent825350a6569f90d5aef281cf977acf60b8f56b8f (diff)
Add latest changes from gitlab-org/gitlab@16-3-stable-ee
-rw-r--r--app/services/ci/create_downstream_pipeline_service.rb3
-rw-r--r--spec/services/ci/create_downstream_pipeline_service_spec.rb18
2 files changed, 21 insertions, 0 deletions
diff --git a/app/services/ci/create_downstream_pipeline_service.rb b/app/services/ci/create_downstream_pipeline_service.rb
index b281f942a14..e38f5c98814 100644
--- a/app/services/ci/create_downstream_pipeline_service.rb
+++ b/app/services/ci/create_downstream_pipeline_service.rb
@@ -42,6 +42,9 @@ module Ci
log_downstream_pipeline_creation(downstream_pipeline)
update_bridge_status!(@bridge, downstream_pipeline)
+ rescue StandardError => e
+ @bridge.reset.drop!(:data_integrity_failure)
+ raise e
end
private
diff --git a/spec/services/ci/create_downstream_pipeline_service_spec.rb b/spec/services/ci/create_downstream_pipeline_service_spec.rb
index 6da6ec3379a..152f408c9f8 100644
--- a/spec/services/ci/create_downstream_pipeline_service_spec.rb
+++ b/spec/services/ci/create_downstream_pipeline_service_spec.rb
@@ -894,4 +894,22 @@ RSpec.describe Ci::CreateDownstreamPipelineService, '#execute', feature_category
end
end
end
+
+ context 'when downstream pipeline creation fails with unexpected errors', :aggregate_failures do
+ before do
+ downstream_project.add_developer(user)
+
+ allow(::Ci::CreatePipelineService).to receive(:new)
+ .and_raise(RuntimeError, 'undefined failure')
+ end
+
+ it 'drops the bridge without creating a pipeline' do
+ expect { subject }
+ .to raise_error(RuntimeError, /undefined failure/)
+ .and change { Ci::Pipeline.count }.by(0)
+
+ expect(bridge.reload).to be_failed
+ expect(bridge.failure_reason).to eq('data_integrity_failure')
+ end
+ end
end