Commit da5b1a23 authored by Maxime Orefice's avatar Maxime Orefice Committed by Alper Akgun

Rename coverage report service

This commit refators our coverage report service to prepare
our new codequality service which will be introduced in a
follow up.
parent 6e00773e
...@@ -249,7 +249,7 @@ module Ci ...@@ -249,7 +249,7 @@ module Ci
after_transition any => ::Ci::Pipeline.completed_statuses do |pipeline| after_transition any => ::Ci::Pipeline.completed_statuses do |pipeline|
pipeline.run_after_commit do pipeline.run_after_commit do
::Ci::Pipelines::CreateArtifactWorker.perform_async(pipeline.id) ::Ci::PipelineArtifacts::CoverageReportWorker.perform_async(pipeline.id)
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
module Pipelines module PipelineArtifacts
class CreateArtifactService class CoverageReportService
def execute(pipeline) def execute(pipeline)
return unless pipeline.can_generate_coverage_reports? return unless pipeline.can_generate_coverage_reports?
return if pipeline.has_coverage_reports? return if pipeline.has_coverage_reports?
......
...@@ -1077,7 +1077,7 @@ ...@@ -1077,7 +1077,7 @@
:weight: 1 :weight: 1
:idempotent: true :idempotent: true
:tags: [] :tags: []
- :name: pipeline_background:ci_pipeline_success_unlock_artifacts - :name: pipeline_background:ci_pipeline_artifacts_coverage_report
:feature_category: :continuous_integration :feature_category: :continuous_integration
:has_external_dependencies: :has_external_dependencies:
:urgency: :low :urgency: :low
...@@ -1085,7 +1085,7 @@ ...@@ -1085,7 +1085,7 @@
:weight: 1 :weight: 1
:idempotent: true :idempotent: true
:tags: [] :tags: []
- :name: pipeline_background:ci_pipelines_create_artifact - :name: pipeline_background:ci_pipeline_success_unlock_artifacts
:feature_category: :continuous_integration :feature_category: :continuous_integration
:has_external_dependencies: :has_external_dependencies:
:urgency: :low :urgency: :low
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
module Pipelines module PipelineArtifacts
class CreateArtifactWorker class CoverageReportWorker
include ApplicationWorker include ApplicationWorker
include PipelineBackgroundQueue include PipelineBackgroundQueue
...@@ -10,7 +10,7 @@ module Ci ...@@ -10,7 +10,7 @@ module Ci
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by_id(pipeline_id).try do |pipeline| Ci::Pipeline.find_by_id(pipeline_id).try do |pipeline|
Ci::Pipelines::CreateArtifactService.new.execute(pipeline) Ci::PipelineArtifacts::CoverageReportService.new.execute(pipeline)
end end
end end
end end
......
---
title: Rename coverage report sidekiq queue
merge_request: 50424
author:
type: changed
# frozen_string_literal: true
class MigrateCoverageReportWorker < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
sidekiq_queue_migrate 'ci_pipelines_create_artifact', to: 'ci_pipeline_artifacts_coverage_report'
end
def down
sidekiq_queue_migrate 'ci_pipeline_artifacts_coverage_report', to: 'ci_pipelines_create_artifact'
end
end
a83762c788d4ec007a26da386dc36bce16b60f5642ed3e6405482acfebefc1be
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe ::Ci::Pipelines::CreateArtifactService do RSpec.describe ::Ci::PipelineArtifacts::CoverageReportService do
describe '#execute' do describe '#execute' do
subject { described_class.new.execute(pipeline) } subject { described_class.new.execute(pipeline) }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe ::Ci::Pipelines::CreateArtifactWorker do RSpec.describe ::Ci::PipelineArtifacts::CoverageReportWorker do
describe '#perform' do describe '#perform' do
subject { described_class.new.perform(pipeline_id) } subject { described_class.new.perform(pipeline_id) }
...@@ -11,7 +11,7 @@ RSpec.describe ::Ci::Pipelines::CreateArtifactWorker do ...@@ -11,7 +11,7 @@ RSpec.describe ::Ci::Pipelines::CreateArtifactWorker do
let(:pipeline_id) { pipeline.id } let(:pipeline_id) { pipeline.id }
it 'calls pipeline report result service' do it 'calls pipeline report result service' do
expect_next_instance_of(::Ci::Pipelines::CreateArtifactService) do |create_artifact_service| expect_next_instance_of(::Ci::PipelineArtifacts::CoverageReportService) do |create_artifact_service|
expect(create_artifact_service).to receive(:execute) expect(create_artifact_service).to receive(:execute)
end end
...@@ -23,7 +23,7 @@ RSpec.describe ::Ci::Pipelines::CreateArtifactWorker do ...@@ -23,7 +23,7 @@ RSpec.describe ::Ci::Pipelines::CreateArtifactWorker do
let(:pipeline_id) { non_existing_record_id } let(:pipeline_id) { non_existing_record_id }
it 'does not call pipeline create artifact service' do it 'does not call pipeline create artifact service' do
expect(Ci::Pipelines::CreateArtifactService).not_to receive(:execute) expect(Ci::PipelineArtifacts::CoverageReportService).not_to receive(:execute)
subject subject
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment