2020-06-02 14:08:32 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Releases
|
|
|
|
class CreateEvidenceService
|
2020-06-16 11:08:32 -04:00
|
|
|
def initialize(release, pipeline: nil)
|
2020-06-02 14:08:32 -04:00
|
|
|
@release = release
|
2020-06-16 11:08:32 -04:00
|
|
|
@pipeline = pipeline
|
2020-06-02 14:08:32 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
evidence = release.evidences.build
|
|
|
|
|
|
|
|
summary = Evidences::EvidenceSerializer.new.represent(evidence) # rubocop: disable CodeReuse/Serializer
|
|
|
|
evidence.summary = summary
|
|
|
|
# TODO: fix the sha generating https://gitlab.com/gitlab-org/gitlab/-/issues/209000
|
|
|
|
evidence.summary_sha = Gitlab::CryptoHelper.sha256(summary)
|
|
|
|
|
|
|
|
evidence.save!
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
attr_reader :release
|
|
|
|
end
|
|
|
|
end
|