Class: Ci::ParseAnnotationsArtifactService
- Inherits:
-
BaseService
- Object
- BaseService
- Ci::ParseAnnotationsArtifactService
- Includes:
- Gitlab::EncodingHelper, Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/ci/parse_annotations_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, #force_encode_utf8, #strip_bom, #unquote_path
Methods inherited from BaseService
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
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 22 23 |
# File 'app/services/ci/parse_annotations_artifact_service.rb', line 11 def execute(artifact) return error('Artifact is not annotations file type', :bad_request) unless artifact&.annotations? return error("Annotations Artifact Too Big. Maximum Allowable Size: #{annotations_size_limit}", :bad_request) if artifact.file.size > annotations_size_limit annotations = parse!(artifact) Ci::JobAnnotation.bulk_upsert!(annotations, unique_by: %i[partition_id job_id name]) success rescue SizeLimitError, ParserError, Gitlab::Json.parser_error, ActiveRecord::RecordInvalid => error error(error., :bad_request) end |