Class: Ci::ParseDotenvArtifactService

Inherits:
BaseService show all
Defined in:
app/services/ci/parse_dotenv_artifact_service.rb

Constant Summary collapse

MAX_ACCEPTABLE_DOTENV_SIZE =
5.kilobytes
MAX_ACCEPTABLE_VARIABLES_COUNT =
10
SizeLimitError =
Class.new(StandardError)
ParserError =
Class.new(StandardError)

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#execute(artifact) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
# File 'app/services/ci/parse_dotenv_artifact_service.rb', line 11

def execute(artifact)
  validate!(artifact)

  variables = parse!(artifact)
  Ci::JobVariable.bulk_insert!(variables)

  success
rescue SizeLimitError, ParserError, ActiveRecord::RecordInvalid => error
  Gitlab::ErrorTracking.track_exception(error, job_id: artifact.job_id)
  error(error.message, :bad_request)
end