Commit 87a9f83c authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'lm-clean-up-ff' into 'master'

Removes ci_same_stage_job_needs ff

See merge request gitlab-org/gitlab!68041
parents 2c2e7081 5e509cf7
...@@ -10,16 +10,9 @@ module Ci ...@@ -10,16 +10,9 @@ module Ci
private private
def process_subsequent_jobs(processable) def process_subsequent_jobs(processable)
if Feature.enabled?(:ci_same_stage_job_needs, processable.project, default_enabled: :yaml) (stage_dependent_jobs(processable) | needs_dependent_jobs(processable))
(stage_dependent_jobs(processable) | needs_dependent_jobs(processable)) .each do |processable|
.each do |processable| process(processable)
process(processable)
end
else
skipped_jobs(processable).after_stage(processable.stage_idx)
.find_each do |job|
process(job)
end
end end
end end
......
---
name: ci_same_stage_job_needs
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59668
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/328253
milestone: '14.1'
type: development
group: group::pipeline authoring
default_enabled: true
...@@ -1594,8 +1594,7 @@ production: ...@@ -1594,8 +1594,7 @@ production:
- In [GitLab 14.1 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/30632) you - In [GitLab 14.1 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/30632) you
can refer to jobs in the same stage as the job you are configuring. This feature is can refer to jobs in the same stage as the job you are configuring. This feature is
enabled on GitLab.com and ready for production use. On self-managed [GitLab 14.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/30632) enabled on GitLab.com and ready for production use. On self-managed [GitLab 14.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/30632)
this feature is available by default. To hide the feature, ask an administrator to this feature is available by default.
[disable the `ci_same_stage_job_needs` flag](../../administration/feature_flags.md).
- In GitLab 14.0 and older, you can only refer to jobs in earlier stages. - In GitLab 14.0 and older, you can only refer to jobs in earlier stages.
- In GitLab 13.9 and older, if `needs:` refers to a job that might not be added to - In GitLab 13.9 and older, if `needs:` refers to a job that might not be added to
a pipeline because of `only`, `except`, or `rules`, the pipeline might fail to create. a pipeline because of `only`, `except`, or `rules`, the pipeline might fail to create.
......
...@@ -15,12 +15,7 @@ module Gitlab ...@@ -15,12 +15,7 @@ module Gitlab
@context = context @context = context
@pipeline = context.pipeline @pipeline = context.pipeline
@seed_attributes = attributes @seed_attributes = attributes
@stages_for_needs_lookup = if Feature.enabled?(:ci_same_stage_job_needs, @pipeline.project, default_enabled: :yaml) @stages_for_needs_lookup = (previous_stages + [current_stage]).compact
(previous_stages + [current_stage]).compact
else
previous_stages
end
@needs_attributes = dig(:needs_attributes) @needs_attributes = dig(:needs_attributes)
@resource_group_key = attributes.delete(:resource_group_key) @resource_group_key = attributes.delete(:resource_group_key)
@job_variables = @seed_attributes.delete(:job_variables) @job_variables = @seed_attributes.delete(:job_variables)
......
...@@ -47,9 +47,7 @@ module Gitlab ...@@ -47,9 +47,7 @@ module Gitlab
validate_job!(name, job) validate_job!(name, job)
end end
if ::Feature.enabled?(:ci_same_stage_job_needs, @opts[:project], default_enabled: :yaml) YamlProcessor::Dag.check_circular_dependencies!(@jobs)
YamlProcessor::Dag.check_circular_dependencies!(@jobs)
end
end end
def validate_job!(name, job) def validate_job!(name, job)
...@@ -103,16 +101,8 @@ module Gitlab ...@@ -103,16 +101,8 @@ module Gitlab
job_stage_index = stage_index(name) job_stage_index = stage_index(name)
dependency_stage_index = stage_index(dependency) dependency_stage_index = stage_index(dependency)
if ::Feature.enabled?(:ci_same_stage_job_needs, @opts[:project], default_enabled: :yaml) unless dependency_stage_index.present? && dependency_stage_index <= job_stage_index
unless dependency_stage_index.present? && dependency_stage_index <= job_stage_index error!("#{name} job: #{dependency_type} #{dependency} is not defined in current or prior stages")
error!("#{name} job: #{dependency_type} #{dependency} is not defined in current or prior stages")
end
else
# A dependency might be defined later in the configuration
# with a stage that does not exist
unless dependency_stage_index.present? && dependency_stage_index < job_stage_index
error!("#{name} job: #{dependency_type} #{dependency} is not defined in prior stages")
end
end end
end end
......
...@@ -1140,16 +1140,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do ...@@ -1140,16 +1140,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
it 'does not have errors' do it 'does not have errors' do
expect(subject.errors).to be_empty expect(subject.errors).to be_empty
end end
context 'when ci_same_stage_job_needs FF is disabled' do
before do
stub_feature_flags(ci_same_stage_job_needs: false)
end
it 'has errors' do
expect(subject.errors).to contain_exactly("'rspec' job needs 'build' job, but 'build' is not in any previous stage")
end
end
end end
context 'when using 101 needs' do context 'when using 101 needs' do
......
...@@ -34,10 +34,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do ...@@ -34,10 +34,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Pipeline do
described_class.new(seed_context, stages_attributes) described_class.new(seed_context, stages_attributes)
end end
before do
stub_feature_flags(ci_same_stage_job_needs: false)
end
describe '#stages' do describe '#stages' do
it 'returns the stage resources' do it 'returns the stage resources' do
stages = seed.stages stages = seed.stages
......
...@@ -590,14 +590,6 @@ module Gitlab ...@@ -590,14 +590,6 @@ module Gitlab
end end
it_behaves_like 'has warnings and expected error', /build job: need test is not defined in current or prior stages/ it_behaves_like 'has warnings and expected error', /build job: need test is not defined in current or prior stages/
context 'with ci_same_stage_job_needs FF disabled' do
before do
stub_feature_flags(ci_same_stage_job_needs: false)
end
it_behaves_like 'has warnings and expected error', /build job: need test is not defined in prior stages/
end
end end
end end
end end
...@@ -1809,14 +1801,6 @@ module Gitlab ...@@ -1809,14 +1801,6 @@ module Gitlab
let(:dependencies) { ['deploy'] } let(:dependencies) { ['deploy'] }
it_behaves_like 'returns errors', 'test1 job: dependency deploy is not defined in current or prior stages' it_behaves_like 'returns errors', 'test1 job: dependency deploy is not defined in current or prior stages'
context 'with ci_same_stage_job_needs FF disabled' do
before do
stub_feature_flags(ci_same_stage_job_needs: false)
end
it_behaves_like 'returns errors', 'test1 job: dependency deploy is not defined in prior stages'
end
end end
context 'when a job depends on another job that references a not-yet defined stage' do context 'when a job depends on another job that references a not-yet defined stage' do
...@@ -2053,14 +2037,6 @@ module Gitlab ...@@ -2053,14 +2037,6 @@ module Gitlab
let(:needs) { ['deploy'] } let(:needs) { ['deploy'] }
it_behaves_like 'returns errors', 'test1 job: need deploy is not defined in current or prior stages' it_behaves_like 'returns errors', 'test1 job: need deploy is not defined in current or prior stages'
context 'with ci_same_stage_job_needs FF disabled' do
before do
stub_feature_flags(ci_same_stage_job_needs: false)
end
it_behaves_like 'returns errors', 'test1 job: need deploy is not defined in prior stages'
end
end end
context 'needs and dependencies that are mismatching' do context 'needs and dependencies that are mismatching' do
......
...@@ -44,16 +44,6 @@ RSpec.describe Ci::AfterRequeueJobService do ...@@ -44,16 +44,6 @@ RSpec.describe Ci::AfterRequeueJobService do
it 'marks subsequent skipped jobs as processable' do it 'marks subsequent skipped jobs as processable' do
expect { execute_service }.to change { test4.reload.status }.from('skipped').to('created') expect { execute_service }.to change { test4.reload.status }.from('skipped').to('created')
end end
context 'with ci_same_stage_job_needs FF disabled' do
before do
stub_feature_flags(ci_same_stage_job_needs: false)
end
it 'does nothing with the build' do
expect { execute_service }.not_to change { test4.reload.status }
end
end
end end
context 'when the pipeline is a downstream pipeline and the bridge is depended' do context 'when the pipeline is a downstream pipeline and the bridge is depended' do
......
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