Class: Ci::ParseDotenvArtifactService

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

Constant Summary collapse

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

Constants included from Gitlab::EncodingHelper

Gitlab::EncodingHelper::BOM_UTF8, Gitlab::EncodingHelper::ENCODING_CONFIDENCE_THRESHOLD, Gitlab::EncodingHelper::ESCAPED_CHARS, Gitlab::EncodingHelper::UNICODE_REPLACEMENT_CHARACTER

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from Gitlab::EncodingHelper

#binary_io, #detect_binary?, #detect_encoding, #detect_libgit2_binary?, #encode!, #encode_binary, #encode_utf8, #encode_utf8_no_detect, #encode_utf8_with_escaping!, #encode_utf8_with_replacement_character, #strip_bom, #unquote_path

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, ActiveRecord::RecordNotUnique => error
  Gitlab::ErrorTracking.track_exception(error, job_id: artifact.job_id)
  error(error.message, :bad_request)
end