2019-10-17 15:06:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 18:09:10 +00:00
|
|
|
class CreateEvidenceWorker # rubocop:disable Scalability/IdempotentWorker
|
2019-10-17 15:06:17 +00:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2020-03-05 18:08:19 +00:00
|
|
|
feature_category :release_evidence
|
2020-01-24 18:09:00 +00:00
|
|
|
weight 2
|
2019-10-18 11:11:44 +00:00
|
|
|
|
2020-06-16 15:08:32 +00:00
|
|
|
# pipeline_id is optional for backward compatibility with existing jobs
|
|
|
|
# caller should always try to provide the pipeline and pass nil only
|
|
|
|
# if pipeline is absent
|
|
|
|
def perform(release_id, pipeline_id = nil)
|
2019-10-17 15:06:17 +00:00
|
|
|
release = Release.find_by_id(release_id)
|
|
|
|
return unless release
|
|
|
|
|
2020-06-16 15:08:32 +00:00
|
|
|
pipeline = Ci::Pipeline.find_by_id(pipeline_id)
|
|
|
|
|
|
|
|
::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute
|
2019-10-17 15:06:17 +00:00
|
|
|
end
|
|
|
|
end
|