debian-mirror-gitlab/app/services/releases/create_evidence_service.rb

32 lines
774 B
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
module Releases
class CreateEvidenceService
def initialize(release, pipeline: nil)
@release = release
@pipeline = pipeline
end
def execute
evidence = release.evidences.build
2020-07-28 23:09:34 +05:30
summary = ::Evidences::EvidenceSerializer.new.represent(evidence, evidence_options) # rubocop: disable CodeReuse/Serializer
2020-06-23 00:09:42 +05:30
evidence.summary = summary
2021-01-03 14:25:43 +05:30
# TODO: fix the sha generation https://gitlab.com/groups/gitlab-org/-/epics/3683
2020-06-23 00:09:42 +05:30
evidence.summary_sha = Gitlab::CryptoHelper.sha256(summary)
evidence.save!
end
private
2020-07-28 23:09:34 +05:30
attr_reader :release, :pipeline
def evidence_options
{}
end
2020-06-23 00:09:42 +05:30
end
end
2020-07-28 23:09:34 +05:30
Releases::CreateEvidenceService.prepend_if_ee('EE::Releases::CreateEvidenceService')