Class: Gitlab::Ci::Pipeline::Chain::Validate::External

Inherits:
Base
  • Object
show all
Includes:
Helpers
Defined in:
lib/gitlab/ci/pipeline/chain/validate/external.rb

Constant Summary collapse

InvalidResponseCode =
Class.new(StandardError)
DEFAULT_VALIDATION_REQUEST_TIMEOUT =
5
ACCEPTED_STATUS =
200
REJECTED_STATUS =
406

Instance Attribute Summary

Attributes inherited from Base

#command, #config, #pipeline

Instance Method Summary collapse

Methods included from Helpers

#error, #warning

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Ci::Pipeline::Chain::Base

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/gitlab/ci/pipeline/chain/validate/external.rb', line 26

def break?
  pipeline.errors.any?
end

#perform!Object



17
18
19
20
21
22
23
24
# File 'lib/gitlab/ci/pipeline/chain/validate/external.rb', line 17

def perform!
  pipeline_authorized = validate_external

  log_message = pipeline_authorized ? 'authorized' : 'not authorized'
  Gitlab::AppLogger.info(message: "Pipeline #{log_message}", project_id: project.id, user_id: current_user.id)

  error('External validation failed', drop_reason: :external_validation_failure) unless pipeline_authorized
end