Commit 95d11019 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add explicit error about downstream project not found

parent 6f22edb6
......@@ -11,7 +11,8 @@ module EE
def failure_reasons
super.merge(protected_environment_failure: 1_000,
insufficient_bridge_permissions: 1_001,
invalid_bridge_trigger: 1_002)
downstream_bridge_project_not_found: 1_002,
invalid_bridge_trigger: 1_003)
end
end
end
......
......@@ -7,6 +7,7 @@ module EE
EE_CALLOUT_FAILURE_MESSAGES = const_get(:CALLOUT_FAILURE_MESSAGES).merge(
protected_environment_failure: 'The environment this job is deploying to is protected. Only users with permission may successfully run this job.',
insufficient_bridge_permissions: 'This job could not be executed because of insufficient permissions to create a downstream pipeline.',
downstream_bridge_project_not_found: 'This job could not be executed because downstream bridge project could not be found.',
invalid_bridge_trigger: 'This job could not be executed because downstream pipeline trigger definition is invalid.'
).freeze
......
......@@ -8,7 +8,7 @@ module Ci
@bridge = bridge
unless target_project_exists?
return bridge.drop!(:invalid_bridge_trigger)
return bridge.drop!(:downstream_bridge_project_not_found)
end
if target_project == project
......
......@@ -12,6 +12,7 @@ module EE
EE_REASONS = const_get(:REASONS).merge(
protected_environment_failure: 'protected environment failure',
invalid_bridge_trigger: 'downstream pipeline trigger definition is invalid',
downstream_bridge_project_not_found: 'downstream project could not be found',
insufficient_bridge_permissions: 'no permissions to trigger downstream pipeline'
).freeze
......
......@@ -46,7 +46,8 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
service.execute(bridge)
expect(bridge.reload).to be_failed
expect(bridge.failure_reason).to eq 'invalid_bridge_trigger'
expect(bridge.failure_reason)
.to eq 'downstream_bridge_project_not_found'
end
end
......@@ -60,7 +61,8 @@ describe Ci::CreateCrossProjectPipelineService, '#execute' do
service.execute(bridge)
expect(bridge.reload).to be_failed
expect(bridge.failure_reason).to eq 'invalid_bridge_trigger'
expect(bridge.failure_reason)
.to eq 'downstream_bridge_project_not_found'
end
end
......
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