Commit 79ef8117 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '270439-remove-ci_seed_block_run_before_workflow_rules' into 'master'

Remove FF ci_seed_block_run_before_workflow_rules

See merge request gitlab-org/gitlab!50595
parents 32b6722a 3d54b561
---
name: ci_seed_block_run_before_workflow_rules
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45674
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/270439
milestone: '13.6'
type: development
group: group::pipeline authoring
default_enabled: true
...@@ -59,10 +59,6 @@ module Gitlab ...@@ -59,10 +59,6 @@ module Gitlab
::Feature.enabled?(:ci_pipeline_open_merge_requests, project, default_enabled: false) ::Feature.enabled?(:ci_pipeline_open_merge_requests, project, default_enabled: false)
end end
def self.seed_block_run_before_workflow_rules_enabled?(project)
::Feature.enabled?(:ci_seed_block_run_before_workflow_rules, project, default_enabled: true)
end
def self.ci_pipeline_editor_page_enabled?(project) def self.ci_pipeline_editor_page_enabled?(project)
::Feature.enabled?(:ci_pipeline_editor_page, project, default_enabled: false) ::Feature.enabled?(:ci_pipeline_editor_page, project, default_enabled: false)
end end
......
...@@ -19,13 +19,6 @@ module Gitlab ...@@ -19,13 +19,6 @@ module Gitlab
# Build to prevent erroring out on ambiguous refs. # Build to prevent erroring out on ambiguous refs.
pipeline.protected = @command.protected_ref? pipeline.protected = @command.protected_ref?
unless ::Gitlab::Ci::Features.seed_block_run_before_workflow_rules_enabled?(project)
##
# Populate pipeline with block argument of CreatePipelineService#execute.
#
@command.seeds_block&.call(pipeline)
end
## ##
# Gather all runtime build/stage errors # Gather all runtime build/stage errors
# #
......
...@@ -9,8 +9,6 @@ module Gitlab ...@@ -9,8 +9,6 @@ module Gitlab
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
def perform! def perform!
return unless ::Gitlab::Ci::Features.seed_block_run_before_workflow_rules_enabled?(project)
## ##
# Populate pipeline with block argument of CreatePipelineService#execute. # Populate pipeline with block argument of CreatePipelineService#execute.
# #
...@@ -20,8 +18,6 @@ module Gitlab ...@@ -20,8 +18,6 @@ module Gitlab
end end
def break? def break?
return false unless ::Gitlab::Ci::Features.seed_block_run_before_workflow_rules_enabled?(project)
pipeline.errors.any? pipeline.errors.any?
end end
end end
......
...@@ -51,18 +51,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::SeedBlock do ...@@ -51,18 +51,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::SeedBlock do
expect(pipeline.variables.size).to eq(1) expect(pipeline.variables.size).to eq(1)
end end
context 'when FF ci_seed_block_run_before_workflow_rules is disabled' do
before do
stub_feature_flags(ci_seed_block_run_before_workflow_rules: false)
end
it 'does not execute the block' do
run_chain
expect(pipeline.variables.size).to eq(0)
end
end
end end
context 'when the seeds_block tries to save the pipelie' do context 'when the seeds_block tries to save the pipelie' do
......
...@@ -20,6 +20,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -20,6 +20,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
describe '#perform!' do describe '#perform!' do
before do before do
stub_ci_pipeline_yaml_file(YAML.dump(config)) stub_ci_pipeline_yaml_file(YAML.dump(config))
run_chain
end end
let(:config) do let(:config) do
...@@ -36,20 +37,14 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -36,20 +37,14 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end end
it 'allocates next IID' do it 'allocates next IID' do
run_chain
expect(pipeline.iid).to be_present expect(pipeline.iid).to be_present
end end
it 'ensures ci_ref' do it 'ensures ci_ref' do
run_chain
expect(pipeline.ci_ref).to be_present expect(pipeline.ci_ref).to be_present
end end
it 'sets the seeds in the command object' do it 'sets the seeds in the command object' do
run_chain
expect(command.pipeline_seed).to be_a(Gitlab::Ci::Pipeline::Seed::Pipeline) expect(command.pipeline_seed).to be_a(Gitlab::Ci::Pipeline::Seed::Pipeline)
expect(command.pipeline_seed.size).to eq 1 expect(command.pipeline_seed.size).to eq 1
end end
...@@ -64,8 +59,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -64,8 +59,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end end
it 'correctly fabricates stages and builds' do it 'correctly fabricates stages and builds' do
run_chain
seed = command.pipeline_seed seed = command.pipeline_seed
expect(seed.stages.size).to eq 2 expect(seed.stages.size).to eq 2
...@@ -91,8 +84,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -91,8 +84,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end end
it 'returns pipeline seed with jobs only assigned to master' do it 'returns pipeline seed with jobs only assigned to master' do
run_chain
seed = command.pipeline_seed seed = command.pipeline_seed
expect(seed.size).to eq 1 expect(seed.size).to eq 1
...@@ -112,8 +103,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -112,8 +103,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end end
it 'returns pipeline seed with jobs only assigned to schedules' do it 'returns pipeline seed with jobs only assigned to schedules' do
run_chain
seed = command.pipeline_seed seed = command.pipeline_seed
expect(seed.size).to eq 1 expect(seed.size).to eq 1
...@@ -141,8 +130,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -141,8 +130,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
let(:pipeline) { build(:ci_pipeline, project: project) } let(:pipeline) { build(:ci_pipeline, project: project) }
it 'returns seeds for kubernetes dependent job' do it 'returns seeds for kubernetes dependent job' do
run_chain
seed = command.pipeline_seed seed = command.pipeline_seed
expect(seed.size).to eq 2 expect(seed.size).to eq 2
...@@ -154,8 +141,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -154,8 +141,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
context 'when kubernetes is not active' do context 'when kubernetes is not active' do
it 'does not return seeds for kubernetes dependent job' do it 'does not return seeds for kubernetes dependent job' do
run_chain
seed = command.pipeline_seed seed = command.pipeline_seed
expect(seed.size).to eq 1 expect(seed.size).to eq 1
...@@ -173,8 +158,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -173,8 +158,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
end end
it 'returns stage seeds only when variables expression is truthy' do it 'returns stage seeds only when variables expression is truthy' do
run_chain
seed = command.pipeline_seed seed = command.pipeline_seed
expect(seed.size).to eq 1 expect(seed.size).to eq 1
...@@ -187,24 +170,8 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do ...@@ -187,24 +170,8 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
->(pipeline) { pipeline.variables.build(key: 'VAR', value: '123') } ->(pipeline) { pipeline.variables.build(key: 'VAR', value: '123') }
end end
context 'when FF ci_seed_block_run_before_workflow_rules is enabled' do it 'does not execute the block' do
it 'does not execute the block' do expect(pipeline.variables.size).to eq(0)
run_chain
expect(pipeline.variables.size).to eq(0)
end
end
context 'when FF ci_seed_block_run_before_workflow_rules is disabled' do
before do
stub_feature_flags(ci_seed_block_run_before_workflow_rules: false)
end
it 'executes the block' do
run_chain
expect(pipeline.variables.size).to eq(1)
end
end end
end end
end end
......
...@@ -2402,16 +2402,6 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -2402,16 +2402,6 @@ RSpec.describe Ci::CreatePipelineService do
expect(build_names).to contain_exactly('regular-job') expect(build_names).to contain_exactly('regular-job')
end end
context 'when FF ci_seed_block_run_before_workflow_rules is disabled' do
before do
stub_feature_flags(ci_seed_block_run_before_workflow_rules: false)
end
it 'does not a pipeline' do
expect(pipeline).not_to be_persisted
end
end
context 'when a job requires the same variable' do context 'when a job requires the same variable' do
let(:config) do let(:config) do
<<-EOY <<-EOY
...@@ -2440,16 +2430,6 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -2440,16 +2430,6 @@ RSpec.describe Ci::CreatePipelineService do
expect(pipeline).to be_persisted expect(pipeline).to be_persisted
expect(build_names).to contain_exactly('build', 'test1', 'test2') expect(build_names).to contain_exactly('build', 'test1', 'test2')
end end
context 'when FF ci_seed_block_run_before_workflow_rules is disabled' do
before do
stub_feature_flags(ci_seed_block_run_before_workflow_rules: false)
end
it 'does not a pipeline' do
expect(pipeline).not_to be_persisted
end
end
end end
end end
...@@ -2460,16 +2440,6 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -2460,16 +2440,6 @@ RSpec.describe Ci::CreatePipelineService do
expect(pipeline).not_to be_persisted expect(pipeline).not_to be_persisted
end end
context 'when FF ci_seed_block_run_before_workflow_rules is disabled' do
before do
stub_feature_flags(ci_seed_block_run_before_workflow_rules: false)
end
it 'does not create a pipeline' do
expect(pipeline).not_to be_persisted
end
end
context 'when a job requires the same variable' do context 'when a job requires the same variable' do
let(:config) do let(:config) do
<<-EOY <<-EOY
...@@ -2497,16 +2467,6 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -2497,16 +2467,6 @@ RSpec.describe Ci::CreatePipelineService do
it 'does not create a pipeline' do it 'does not create a pipeline' do
expect(pipeline).not_to be_persisted expect(pipeline).not_to be_persisted
end end
context 'when FF ci_seed_block_run_before_workflow_rules is disabled' do
before do
stub_feature_flags(ci_seed_block_run_before_workflow_rules: false)
end
it 'does not create a pipeline' do
expect(pipeline).not_to be_persisted
end
end
end end
end end
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