Commit 3804a2f1 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'remove-ci-plan-needs' into 'master'

Remove `ci_plan_needs_size_limit` feature flag

Closes #238173

See merge request gitlab-org/gitlab!42584
parents 8cd20069 710caac8
---
name: ci_plan_needs_size_limit
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37568
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238173
group: group::ci
type: development
default_enabled: true
\ No newline at end of file
...@@ -2088,9 +2088,7 @@ This example creates four paths of execution: ...@@ -2088,9 +2088,7 @@ This example creates four paths of execution:
- The maximum number of jobs that a single job can need in the `needs:` array is limited: - The maximum number of jobs that a single job can need in the `needs:` array is limited:
- For GitLab.com, the limit is 50. For more information, see our - For GitLab.com, the limit is 50. For more information, see our
[infrastructure issue](https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/7541). [infrastructure issue](https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/7541).
- For self-managed instances, the limit is: - For self-managed instances, the limit is: 50. This limit [can be changed](#changing-the-needs-job-limit).
- 10, if the `ci_plan_needs_size_limit` feature flag is disabled (default).
- 50, if the `ci_plan_needs_size_limit` feature flag is enabled. This limit [can be changed](#changing-the-needs-job-limit).
- If `needs:` refers to a job that is marked as `parallel:`. - If `needs:` refers to a job that is marked as `parallel:`.
the current job will depend on all parallel jobs created. the current job will depend on all parallel jobs created.
- `needs:` is similar to `dependencies:` in that it needs to use jobs from prior stages, - `needs:` is similar to `dependencies:` in that it needs to use jobs from prior stages,
......
...@@ -46,10 +46,6 @@ module Gitlab ...@@ -46,10 +46,6 @@ module Gitlab
::Feature.enabled?(:ci_disallow_to_create_merge_request_pipelines_in_target_project, target_project) ::Feature.enabled?(:ci_disallow_to_create_merge_request_pipelines_in_target_project, target_project)
end end
def self.ci_plan_needs_size_limit?(project)
::Feature.enabled?(:ci_plan_needs_size_limit, project, default_enabled: true)
end
def self.lint_creates_pipeline_with_dry_run?(project) def self.lint_creates_pipeline_with_dry_run?(project)
::Feature.enabled?(:ci_lint_creates_pipeline_with_dry_run, project, default_enabled: true) ::Feature.enabled?(:ci_lint_creates_pipeline_with_dry_run, project, default_enabled: true)
end end
......
...@@ -11,8 +11,6 @@ module Gitlab ...@@ -11,8 +11,6 @@ module Gitlab
delegate :dig, to: :@seed_attributes delegate :dig, to: :@seed_attributes
DEFAULT_NEEDS_LIMIT = 10
def initialize(pipeline, attributes, previous_stages) def initialize(pipeline, attributes, previous_stages)
@pipeline = pipeline @pipeline = pipeline
@seed_attributes = attributes @seed_attributes = attributes
...@@ -140,11 +138,7 @@ module Gitlab ...@@ -140,11 +138,7 @@ module Gitlab
end end
def max_needs_allowed def max_needs_allowed
if ::Gitlab::Ci::Features.ci_plan_needs_size_limit?(@pipeline.project) @pipeline.project.actual_limits.ci_needs_size_limit
@pipeline.project.actual_limits.ci_needs_size_limit
else
DEFAULT_NEEDS_LIMIT
end
end end
def pipeline_attributes def pipeline_attributes
......
...@@ -931,47 +931,30 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do ...@@ -931,47 +931,30 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
context 'when using 101 needs' do context 'when using 101 needs' do
let(:needs_count) { 101 } let(:needs_count) { 101 }
context 'when ci_plan_needs_size_limit is disabled' do it "returns an error" do
expect(subject.errors).to contain_exactly(
"rspec: one job can only need 50 others, but you have listed 101. See needs keyword documentation for more details")
end
context 'when ci_needs_size_limit is set to 100' do
before do before do
stub_feature_flags(ci_plan_needs_size_limit: false) project.actual_limits.update!(ci_needs_size_limit: 100)
end end
it "returns an error" do it "returns an error" do
expect(subject.errors).to contain_exactly( expect(subject.errors).to contain_exactly(
"rspec: one job can only need 10 others, but you have listed 101. See needs keyword documentation for more details") "rspec: one job can only need 100 others, but you have listed 101. See needs keyword documentation for more details")
end end
end end
context 'when ci_plan_needs_size_limit is enabled' do context 'when ci_needs_size_limit is set to 0' do
before do before do
stub_feature_flags(ci_plan_needs_size_limit: true) project.actual_limits.update!(ci_needs_size_limit: 0)
end end
it "returns an error" do it "returns an error" do
expect(subject.errors).to contain_exactly( expect(subject.errors).to contain_exactly(
"rspec: one job can only need 50 others, but you have listed 101. See needs keyword documentation for more details") "rspec: one job can only need 0 others, but you have listed 101. See needs keyword documentation for more details")
end
context 'when ci_needs_size_limit is set to 100' do
before do
project.actual_limits.update!(ci_needs_size_limit: 100)
end
it "returns an error" do
expect(subject.errors).to contain_exactly(
"rspec: one job can only need 100 others, but you have listed 101. See needs keyword documentation for more details")
end
end
context 'when ci_needs_size_limit is set to 0' do
before do
project.actual_limits.update!(ci_needs_size_limit: 0)
end
it "returns an error" do
expect(subject.errors).to contain_exactly(
"rspec: one job can only need 0 others, but you have listed 101. See needs keyword documentation for more details")
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