Commit 933f2cb3 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Resolve CE/EE conflicts related to pipeline seeds

parent b0191139
...@@ -7,11 +7,8 @@ module Ci ...@@ -7,11 +7,8 @@ module Ci
include Presentable include Presentable
include Gitlab::OptimisticLocking include Gitlab::OptimisticLocking
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
<<<<<<< HEAD
prepend ::EE::Ci::Pipeline prepend ::EE::Ci::Pipeline
=======
>>>>>>> upstream/master
belongs_to :project, inverse_of: :pipelines belongs_to :project, inverse_of: :pipelines
belongs_to :user belongs_to :user
......
...@@ -8,15 +8,10 @@ module Ci ...@@ -8,15 +8,10 @@ module Ci
Gitlab::Ci::Pipeline::Chain::Validate::Repository, Gitlab::Ci::Pipeline::Chain::Validate::Repository,
Gitlab::Ci::Pipeline::Chain::Validate::Config, Gitlab::Ci::Pipeline::Chain::Validate::Config,
Gitlab::Ci::Pipeline::Chain::Skip, Gitlab::Ci::Pipeline::Chain::Skip,
<<<<<<< HEAD
EE::Gitlab::Ci::Pipeline::Chain::Limit::Size, EE::Gitlab::Ci::Pipeline::Chain::Limit::Size,
Gitlab::Ci::Pipeline::Chain::Populate, Gitlab::Ci::Pipeline::Chain::Populate,
Gitlab::Ci::Pipeline::Chain::Create, Gitlab::Ci::Pipeline::Chain::Create,
EE::Gitlab::Ci::Pipeline::Chain::Limit::Activity].freeze EE::Gitlab::Ci::Pipeline::Chain::Limit::Activity].freeze
=======
Gitlab::Ci::Pipeline::Chain::Populate,
Gitlab::Ci::Pipeline::Chain::Create].freeze
>>>>>>> upstream/master
def execute(source, ignore_skip_ci: false, save_on_errors: true, trigger_request: nil, schedule: nil, mirror_update: false, &block) def execute(source, ignore_skip_ci: false, save_on_errors: true, trigger_request: nil, schedule: nil, mirror_update: false, &block)
@pipeline = Ci::Pipeline.new @pipeline = Ci::Pipeline.new
......
...@@ -20,7 +20,6 @@ module Ci ...@@ -20,7 +20,6 @@ module Ci
.execute(:trigger, ignore_skip_ci: true) do |pipeline| .execute(:trigger, ignore_skip_ci: true) do |pipeline|
pipeline.trigger_requests.build(trigger: trigger) pipeline.trigger_requests.build(trigger: trigger)
pipeline.variables.build(variables) pipeline.variables.build(variables)
<<<<<<< HEAD
end end
if pipeline.persisted? if pipeline.persisted?
...@@ -46,8 +45,6 @@ module Ci ...@@ -46,8 +45,6 @@ module Ci
pipeline.source_pipeline = source pipeline.source_pipeline = source
pipeline.variables.build(variables) pipeline.variables.build(variables)
=======
>>>>>>> upstream/master
end end
if pipeline.persisted? if pipeline.persisted?
...@@ -63,15 +60,12 @@ module Ci ...@@ -63,15 +60,12 @@ module Ci
end end
end end
<<<<<<< HEAD
def job_from_token def job_from_token
strong_memoize(:job) do strong_memoize(:job) do
Ci::Build.find_by_token(params[:token].to_s) Ci::Build.find_by_token(params[:token].to_s)
end end
end end
=======
>>>>>>> upstream/master
def variables def variables
params[:variables].to_h.map do |key, value| params[:variables].to_h.map do |key, value|
{ key: key, value: value } { key: key, value: value }
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Ci::Pipeline::Chain::Populate do describe Gitlab::Ci::Pipeline::Chain::Populate do
<<<<<<< HEAD
set(:project) { create(:project, :repository) } set(:project) { create(:project, :repository) }
=======
set(:project) { create(:project) }
>>>>>>> upstream/master
set(:user) { create(:user) } set(:user) { create(:user) }
let(:pipeline) do let(:pipeline) do
...@@ -143,11 +139,7 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do ...@@ -143,11 +139,7 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
end end
let(:pipeline) do let(:pipeline) do
<<<<<<< HEAD
build(:ci_pipeline, ref: 'master', project: project, config: config) build(:ci_pipeline, ref: 'master', project: project, config: config)
=======
build(:ci_pipeline, ref: 'master', config: config)
>>>>>>> upstream/master
end end
it 'populates pipeline according to used policies' do it 'populates pipeline according to used policies' do
......
...@@ -238,12 +238,8 @@ describe Ci::Pipeline, :mailer do ...@@ -238,12 +238,8 @@ describe Ci::Pipeline, :mailer do
describe 'pipeline stages' do describe 'pipeline stages' do
describe '#stage_seeds' do describe '#stage_seeds' do
<<<<<<< HEAD
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:pipeline) { build(:ci_pipeline, project: project, config: config) } let(:pipeline) { build(:ci_pipeline, project: project, config: config) }
=======
let(:pipeline) { build(:ci_pipeline, config: config) }
>>>>>>> upstream/master
let(:config) { { rspec: { script: 'rake' } } } let(:config) { { rspec: { script: 'rake' } } }
it 'returns preseeded stage seeds object' do it 'returns preseeded stage seeds object' do
...@@ -258,17 +254,10 @@ describe Ci::Pipeline, :mailer do ...@@ -258,17 +254,10 @@ describe Ci::Pipeline, :mailer do
rspec: { stage: 'test', script: 'rspec' }, rspec: { stage: 'test', script: 'rspec' },
spinach: { stage: 'test', script: 'spinach' } } spinach: { stage: 'test', script: 'spinach' } }
end end
<<<<<<< HEAD
it 'correctly fabricates a stage seeds object' do it 'correctly fabricates a stage seeds object' do
seeds = pipeline.stage_seeds seeds = pipeline.stage_seeds
=======
it 'correctly fabricates a stage seeds object' do
seeds = pipeline.stage_seeds
>>>>>>> upstream/master
expect(seeds.size).to eq 2 expect(seeds.size).to eq 2
expect(seeds.first.attributes[:name]).to eq 'test' expect(seeds.first.attributes[:name]).to eq 'test'
expect(seeds.second.attributes[:name]).to eq 'deploy' expect(seeds.second.attributes[:name]).to eq 'deploy'
...@@ -280,11 +269,7 @@ describe Ci::Pipeline, :mailer do ...@@ -280,11 +269,7 @@ describe Ci::Pipeline, :mailer do
context 'when refs policy is specified' do context 'when refs policy is specified' do
let(:pipeline) do let(:pipeline) do
<<<<<<< HEAD
build(:ci_pipeline, ref: 'feature', tag: true, project: project, config: config) build(:ci_pipeline, ref: 'feature', tag: true, project: project, config: config)
=======
build(:ci_pipeline, ref: 'feature', tag: true, config: config)
>>>>>>> upstream/master
end end
let(:config) do let(:config) do
...@@ -302,17 +287,10 @@ describe Ci::Pipeline, :mailer do ...@@ -302,17 +287,10 @@ describe Ci::Pipeline, :mailer do
end end
context 'when source policy is specified' do context 'when source policy is specified' do
<<<<<<< HEAD
let(:pipeline) do let(:pipeline) do
build(:ci_pipeline, source: :schedule, project: project, config: config) build(:ci_pipeline, source: :schedule, project: project, config: config)
end end
let(:config) do
{ production: { stage: 'deploy', script: 'cap prod', only: ['triggers'] },
spinach: { stage: 'test', script: 'spinach', only: ['schedules'] } }
=======
let(:pipeline) { build(:ci_pipeline, source: :schedule, config: config) }
let(:config) do let(:config) do
{ production: { stage: 'deploy', script: 'cap prod', only: ['triggers'] }, { production: { stage: 'deploy', script: 'cap prod', only: ['triggers'] },
spinach: { stage: 'test', script: 'spinach', only: ['schedules'] } } spinach: { stage: 'test', script: 'spinach', only: ['schedules'] } }
...@@ -324,22 +302,9 @@ describe Ci::Pipeline, :mailer do ...@@ -324,22 +302,9 @@ describe Ci::Pipeline, :mailer do
expect(seeds.size).to eq 1 expect(seeds.size).to eq 1
expect(seeds.first.attributes[:name]).to eq 'test' expect(seeds.first.attributes[:name]).to eq 'test'
expect(seeds.dig(0, 0, :name)).to eq 'spinach' expect(seeds.dig(0, 0, :name)).to eq 'spinach'
>>>>>>> upstream/master
end end
end end
<<<<<<< HEAD
it 'returns stage seeds only assigned to schedules' do
seeds = pipeline.stage_seeds
expect(seeds.size).to eq 1
expect(seeds.first.attributes[:name]).to eq 'test'
expect(seeds.dig(0, 0, :name)).to eq 'spinach'
end
end
=======
>>>>>>> upstream/master
context 'when kubernetes policy is specified' do context 'when kubernetes policy is specified' do
let(:config) do let(:config) do
{ {
...@@ -351,21 +316,12 @@ describe Ci::Pipeline, :mailer do ...@@ -351,21 +316,12 @@ describe Ci::Pipeline, :mailer do
} }
} }
end end
<<<<<<< HEAD
context 'when kubernetes is active' do context 'when kubernetes is active' do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
it 'returns seeds for kubernetes dependent job' do it 'returns seeds for kubernetes dependent job' do
seeds = pipeline.stage_seeds seeds = pipeline.stage_seeds
=======
context 'when kubernetes is active' do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
it 'returns seeds for kubernetes dependent job' do
seeds = pipeline.stage_seeds
>>>>>>> upstream/master
expect(seeds.size).to eq 2 expect(seeds.size).to eq 2
expect(seeds.dig(0, 0, :name)).to eq 'spinach' expect(seeds.dig(0, 0, :name)).to eq 'spinach'
expect(seeds.dig(1, 0, :name)).to eq 'production' expect(seeds.dig(1, 0, :name)).to eq 'production'
...@@ -373,11 +329,7 @@ describe Ci::Pipeline, :mailer do ...@@ -373,11 +329,7 @@ describe Ci::Pipeline, :mailer do
end end
context 'when user configured kubernetes from Integration > Kubernetes' do context 'when user configured kubernetes from Integration > Kubernetes' do
<<<<<<< HEAD
let(:project) { create(:kubernetes_project, :repository) } let(:project) { create(:kubernetes_project, :repository) }
=======
let(:project) { create(:kubernetes_project) }
>>>>>>> upstream/master
let(:pipeline) { build(:ci_pipeline, project: project, config: config) } let(:pipeline) { build(:ci_pipeline, project: project, config: config) }
it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes'
...@@ -405,28 +357,17 @@ describe Ci::Pipeline, :mailer do ...@@ -405,28 +357,17 @@ describe Ci::Pipeline, :mailer do
describe '#seeds_size' do describe '#seeds_size' do
context 'when refs policy is specified' do context 'when refs policy is specified' do
<<<<<<< HEAD
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
=======
>>>>>>> upstream/master
let(:config) do let(:config) do
{ production: { stage: 'deploy', script: 'cap prod', only: ['master'] }, { production: { stage: 'deploy', script: 'cap prod', only: ['master'] },
spinach: { stage: 'test', script: 'spinach', only: ['tags'] } } spinach: { stage: 'test', script: 'spinach', only: ['tags'] } }
end end
<<<<<<< HEAD
let(:pipeline) do let(:pipeline) do
build(:ci_pipeline, ref: 'feature', tag: true, project: project, config: config) build(:ci_pipeline, ref: 'feature', tag: true, project: project, config: config)
end end
=======
let(:pipeline) do
build(:ci_pipeline, ref: 'feature', tag: true, config: config)
end
>>>>>>> upstream/master
it 'returns real seeds size' do it 'returns real seeds size' do
expect(pipeline.seeds_size).to eq 1 expect(pipeline.seeds_size).to eq 1
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