2016-10-13 06:58:25 -04:00
|
|
|
class BuildSuccessWorker
|
|
|
|
include Sidekiq::Worker
|
2016-10-21 12:13:41 -04:00
|
|
|
include BuildQueue
|
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
|