2019-12-21 20:55:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
class CreateEvidenceWorker # rubocop:disable Scalability/IdempotentWorker
|
2019-12-21 20:55:43 +05:30
|
|
|
include ApplicationWorker
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
feature_category :release_evidence
|
2020-03-13 15:44:24 +05:30
|
|
|
weight 2
|
2019-12-21 20:55:43 +05:30
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
# 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-12-21 20:55:43 +05:30
|
|
|
release = Release.find_by_id(release_id)
|
|
|
|
return unless release
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
pipeline = Ci::Pipeline.find_by_id(pipeline_id)
|
|
|
|
|
|
|
|
::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute
|
2019-12-21 20:55:43 +05:30
|
|
|
end
|
|
|
|
end
|