Class: Ci::ParseDotenvArtifactService

Inherits:
BaseService show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/ci/parse_dotenv_artifact_service.rb

Constant Summary collapse

SizeLimitError =
Class.new(StandardError)
ParserError =
Class.new(StandardError)

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

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


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

def execute(artifact)
  validate!(artifact)

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

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