Class: Ci::Pipelines::CreateArtifactService

Inherits:
Object
  • Object
show all
Defined in:
app/services/ci/pipelines/create_artifact_service.rb

Instance Method Summary collapse

Instance Method Details

#execute(pipeline) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/ci/pipelines/create_artifact_service.rb', line 5

def execute(pipeline)
  return unless ::Gitlab::Ci::Features.coverage_report_view?(pipeline.project)
  return unless pipeline.can_generate_coverage_reports?
  return if pipeline.has_coverage_reports?

  file = build_carrierwave_file(pipeline)

  pipeline.pipeline_artifacts.create!(
    project_id: pipeline.project_id,
    file_type: :code_coverage,
    file_format: :raw,
    size: file["tempfile"].size,
    file: file,
    expire_at: Ci::PipelineArtifact::EXPIRATION_DATE.from_now
  )
end