Commit ab8edd16 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'rename-create-cross-project-pipeline-service' into 'master'

Rename pipeline service from "cross-project" to "downstream"

See merge request gitlab-org/gitlab!20966
parents a3183c76 5093487f
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
# TODO: rename this (and worker) to CreateDownstreamPipelineService # Takes in input a Ci::Bridge job and creates a downstream pipeline
class CreateCrossProjectPipelineService < ::BaseService # (either multi-project or child pipeline) according to the Ci::Bridge
# specifications.
class CreateDownstreamPipelineService < ::BaseService
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
DuplicateDownstreamPipelineError = Class.new(StandardError) DuplicateDownstreamPipelineError = Class.new(StandardError)
......
...@@ -9,7 +9,7 @@ module Ci ...@@ -9,7 +9,7 @@ module Ci
def perform(bridge_id) def perform(bridge_id)
::Ci::Bridge.find_by_id(bridge_id).try do |bridge| ::Ci::Bridge.find_by_id(bridge_id).try do |bridge|
::Ci::CreateCrossProjectPipelineService ::Ci::CreateDownstreamPipelineService
.new(bridge.project, bridge.user) .new(bridge.project, bridge.user)
.execute(bridge) .execute(bridge)
end end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Ci::CreateCrossProjectPipelineService, '#execute' do RSpec.describe Ci::CreateDownstreamPipelineService, '#execute' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:upstream_project) { create(:project, :repository) } let(:upstream_project) { create(:project, :repository) }
let_it_be(:downstream_project) { create(:project, :repository) } let_it_be(:downstream_project) { create(:project, :repository) }
...@@ -130,7 +130,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineService, '#execute' do ...@@ -130,7 +130,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineService, '#execute' do
expect(Gitlab::ErrorTracking) expect(Gitlab::ErrorTracking)
.to receive(:track_exception) .to receive(:track_exception)
.with( .with(
instance_of(Ci::CreateCrossProjectPipelineService::DuplicateDownstreamPipelineError), instance_of(described_class::DuplicateDownstreamPipelineError),
bridge_id: bridge.id, project_id: bridge.project.id) bridge_id: bridge.id, project_id: bridge.project.id)
.and_call_original .and_call_original
expect(Ci::CreatePipelineService).not_to receive(:new) expect(Ci::CreatePipelineService).not_to receive(:new)
...@@ -397,7 +397,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineService, '#execute' do ...@@ -397,7 +397,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineService, '#execute' do
context 'when pipeline variables are defined' do context 'when pipeline variables are defined' do
before do before do
upstream_pipeline.variables.create(key: 'PIPELINE_VARIABLE', value: 'my-value') upstream_pipeline.variables.create!(key: 'PIPELINE_VARIABLE', value: 'my-value')
end end
it 'does not pass pipeline variables directly downstream' do it 'does not pass pipeline variables directly downstream' do
......
...@@ -13,7 +13,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineWorker do ...@@ -13,7 +13,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineWorker do
describe '#perform' do describe '#perform' do
context 'when bridge exists' do context 'when bridge exists' do
it 'calls cross project pipeline creation service' do it 'calls cross project pipeline creation service' do
expect(Ci::CreateCrossProjectPipelineService) expect(Ci::CreateDownstreamPipelineService)
.to receive(:new) .to receive(:new)
.with(project, user) .with(project, user)
.and_return(service) .and_return(service)
...@@ -26,7 +26,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineWorker do ...@@ -26,7 +26,7 @@ RSpec.describe Ci::CreateCrossProjectPipelineWorker do
context 'when bridge does not exist' do context 'when bridge does not exist' do
it 'does nothing' do it 'does nothing' do
expect(Ci::CreateCrossProjectPipelineService) expect(Ci::CreateDownstreamPipelineService)
.not_to receive(:new) .not_to receive(:new)
described_class.new.perform(non_existing_record_id) described_class.new.perform(non_existing_record_id)
......
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