gitlab-org--gitlab-foss/app/workers/build_success_worker.rb
Thong Kuah 26b057293d Remove deprecated call in BuildSuccessWorker
We now create_deployment on Ci::Build create.
No need to call create_deployment again
2019-06-24 10:37:47 +12:00

24 lines
622 B
Ruby

# frozen_string_literal: true
class BuildSuccessWorker
include ApplicationWorker
include PipelineQueue
queue_namespace :pipeline_processing
# rubocop: disable CodeReuse/ActiveRecord
def perform(build_id)
Ci::Build.find_by(id: build_id).try do |build|
stop_environment(build) if build.stops_environment?
end
end
# rubocop: enable CodeReuse/ActiveRecord
private
##
# TODO: This should be processed in DeploymentSuccessWorker once we started storing `action` value in `deployments` records
def stop_environment(build)
build.persisted_environment.fire_state_event(:stop)
end
end