Class: Ci::PipelineArtifact

Inherits:
ApplicationRecord show all
Includes:
Artifactable, FileStoreMounter, Presentable, UpdateProjectStatistics
Defined in:
app/models/ci/pipeline_artifact.rb

Constant Summary collapse

FILE_SIZE_LIMIT =
10.megabytes.freeze
EXPIRATION_DATE =
1.week.freeze
DEFAULT_FILE_NAMES =
{
  code_coverage: 'code_coverage.json',
  code_quality_mr_diff: 'code_quality_mr_diff.json'
}.freeze
REPORT_TYPES =
{
  code_coverage: :raw,
  code_quality_mr_diff: :raw
}.freeze

Constants included from Artifactable

Artifactable::FILE_FORMAT_ADAPTERS, Artifactable::NotSupportedAdapterError, Artifactable::STORE_COLUMN

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FileStoreMounter

#update_file_store

Methods included from Artifactable

#each_blob

Methods included from AfterCommitQueue

#run_after_commit, #run_after_commit_or_now

Methods inherited from ApplicationRecord

model_name, table_name_prefix

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.find_by_file_type(file_type) ⇒ Object


51
52
53
# File 'app/models/ci/pipeline_artifact.rb', line 51

def find_by_file_type(file_type)
  find_by(file_type: file_type)
end

.report_exists?(file_type) ⇒ Boolean

Returns:

  • (Boolean)

45
46
47
48
49
# File 'app/models/ci/pipeline_artifact.rb', line 45

def report_exists?(file_type)
  return false unless REPORT_TYPES.key?(file_type)

  where(file_type: file_type).exists?
end

Instance Method Details

#presentObject


56
57
58
# File 'app/models/ci/pipeline_artifact.rb', line 56

def present
  super(presenter_class: "Ci::PipelineArtifacts::#{self.file_type.camelize}Presenter".constantize)
end