2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-13 06:58:25 -04:00
|
|
|
class BuildSuccessWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2017-08-21 08:16:51 -04:00
|
|
|
include PipelineQueue
|
|
|
|
|
2017-11-28 11:16:50 -05:00
|
|
|
queue_namespace :pipeline_processing
|
2016-10-13 06:58:25 -04:00
|
|
|
|
|
|
|
def perform(build_id)
|
|
|
|
Ci::Build.find_by(id: build_id).try do |build|
|
2016-11-17 06:08:28 -05:00
|
|
|
create_deployment(build) if build.has_environment?
|
2016-10-13 06:58:25 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-10-13 09:24:33 -04:00
|
|
|
def create_deployment(build)
|
2017-06-01 09:01:32 -04:00
|
|
|
CreateDeploymentService.new(build).execute
|
2016-10-13 06:58:25 -04:00
|
|
|
end
|
|
|
|
end
|