Commit 425ce627 authored by Matija Čupić's avatar Matija Čupić

Log events for external pipeline validation

parent cf907e7c
......@@ -13,7 +13,12 @@ module Gitlab
VALIDATION_REQUEST_TIMEOUT = 5
def perform!
error('External validation failed', drop_reason: :external_validation_failure) unless validate_external
pipeline_authorized = validate_external
log_message = pipeline_authorized ? 'authorized' : 'not authorized'
Gitlab::AppLogger.info(message: "Pipeline #{log_message}", project_id: @pipeline.project.id, user_id: @pipeline.user.id)
error('External validation failed', drop_reason: :external_validation_failure) unless pipeline_authorized
end
def break?
......
......@@ -67,6 +67,12 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::External do
expect(step.break?).to be false
end
it 'logs the authorization' do
expect(Gitlab::AppLogger).to receive(:info).with(message: 'Pipeline authorized', project_id: project.id, user_id: user.id)
perform!
end
end
context 'when validation return false' do
......@@ -86,6 +92,12 @@ describe Gitlab::Ci::Pipeline::Chain::Validate::External do
expect(step.break?).to be true
end
it 'logs the authorization' do
expect(Gitlab::AppLogger).to receive(:info).with(message: 'Pipeline not authorized', project_id: project.id, user_id: user.id)
perform!
end
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