debian-mirror-gitlab/app/services/releases/create_evidence_service.rb
2021-01-30 21:13:32 +05:30

31 lines
774 B
Ruby

# frozen_string_literal: true
module Releases
class CreateEvidenceService
def initialize(release, pipeline: nil)
@release = release
@pipeline = pipeline
end
def execute
evidence = release.evidences.build
summary = ::Evidences::EvidenceSerializer.new.represent(evidence, evidence_options) # rubocop: disable CodeReuse/Serializer
evidence.summary = summary
# TODO: fix the sha generation https://gitlab.com/groups/gitlab-org/-/epics/3683
evidence.summary_sha = Gitlab::CryptoHelper.sha256(summary)
evidence.save!
end
private
attr_reader :release, :pipeline
def evidence_options
{}
end
end
end
Releases::CreateEvidenceService.prepend_if_ee('EE::Releases::CreateEvidenceService')