gitlab-org--gitlab-foss/app/workers/build_finished_worker.rb
Shinya Maeda 3fc4c096a5 Squashed commit of the following:
commit 9d9594ba20097dc4598f7eb42a9f9d78d73eae54
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Sep 13 20:18:31 2018 +0900

    Cancel scheduled jobs

commit f31c7172e07a9eb03b58c1e62eaa18cda4064aa6
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Thu Sep 13 11:18:42 2018 +0900

    Add Ci::BuildSchedule

commit fb6b3ca638f40f9e1ee38b1fdd892bda4f6fede7
Author: Shinya Maeda <shinya@gitlab.com>
Date:   Wed Sep 12 20:02:50 2018 +0900

    Scheduled jobs
2018-10-02 16:57:37 +02:00

23 lines
789 B
Ruby

# frozen_string_literal: true
class BuildFinishedWorker
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|
build&.build_schedule&.delete
# We execute that in sync as this access the files in order to access local file, and reduce IO
BuildTraceSectionsWorker.new.perform(build.id)
BuildCoverageWorker.new.perform(build.id)
# We execute that async as this are two indepentent operations that can be executed after TraceSections and Coverage
BuildHooksWorker.perform_async(build.id)
ArchiveTraceWorker.perform_async(build.id)
end
end
# rubocop: enable CodeReuse/ActiveRecord
end