2019-10-17 11:06:17 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-02-19 13:09:10 -05:00
|
|
|
class CreateEvidenceWorker # rubocop:disable Scalability/IdempotentWorker
|
2019-10-17 11:06:17 -04:00
|
|
|
include ApplicationWorker
|
|
|
|
|
2020-03-05 13:08:19 -05:00
|
|
|
feature_category :release_evidence
|
2020-01-24 13:09:00 -05:00
|
|
|
weight 2
|
2019-10-18 07:11:44 -04:00
|
|
|
|
2020-06-16 11:08:32 -04: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 11:06:17 -04:00
|
|
|
release = Release.find_by_id(release_id)
|
|
|
|
return unless release
|
|
|
|
|
2020-06-16 11:08:32 -04:00
|
|
|
pipeline = Ci::Pipeline.find_by_id(pipeline_id)
|
|
|
|
|
|
|
|
::Releases::CreateEvidenceService.new(release, pipeline: pipeline).execute
|
2019-10-17 11:06:17 -04:00
|
|
|
end
|
|
|
|
end
|