gitlab-org--gitlab-foss/app/workers/build_success_worker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
564 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class BuildSuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
include PipelineQueue
2017-11-28 11:16:50 -05:00
queue_namespace :pipeline_processing
urgency :high
def perform(build_id)
Ci::Build.find_by_id(build_id).try do |build|
stop_environment(build) if build.stops_environment? && build.stop_action_successful?
end
end
private
def stop_environment(build)
build.persisted_environment.fire_state_event(:stop_complete)
end
end