Still allow legacy triggers, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11910#note_31632911
This commit is contained in:
parent
e86e1e515a
commit
6d17ddac5a
2 changed files with 6 additions and 8 deletions
|
@ -23,10 +23,6 @@ module Ci
|
|||
return error('Insufficient permissions to create a new pipeline')
|
||||
end
|
||||
|
||||
if trigger_request && !trigger_request.trigger.owner
|
||||
return error('Legacy trigger without a owner is not allowed')
|
||||
end
|
||||
|
||||
unless branch? || tag?
|
||||
return error('Reference not found')
|
||||
end
|
||||
|
@ -63,7 +59,9 @@ module Ci
|
|||
def triggering_user_allowed_for_ref?(trigger_request, ref)
|
||||
triggering_user = current_user || trigger_request.trigger.owner
|
||||
|
||||
Ci::Pipeline.allowed_to_create?(triggering_user, project, ref)
|
||||
(triggering_user &&
|
||||
Ci::Pipeline.allowed_to_create?(triggering_user, project, ref)) ||
|
||||
!project.protected_for?(ref)
|
||||
end
|
||||
|
||||
def process!
|
||||
|
|
|
@ -415,10 +415,10 @@ describe Ci::CreatePipelineService, services: true do
|
|||
let(:user) {}
|
||||
let(:trigger_request) { create(:ci_trigger_request) }
|
||||
|
||||
it 'does not create a pipeline' do
|
||||
it 'creates a pipeline' do
|
||||
expect(execute_service(trigger_request: trigger_request))
|
||||
.not_to be_persisted
|
||||
expect(Ci::Pipeline.count).to eq(0)
|
||||
.to be_persisted
|
||||
expect(Ci::Pipeline.count).to eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue