Commit 34126e4f authored by Mark Chao's avatar Mark Chao

Merge branch '323891-delete-ci_needs_optional' into 'master'

Remove the FF ci_needs_optional [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!62282
parents 7e75dc1e d0c8120a
---
name: ci_needs_optional
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55468
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323891
milestone: '13.10'
type: development
group: group::pipeline authoring
default_enabled: true
...@@ -2069,14 +2069,7 @@ To download artifacts from a job in the current pipeline, use the basic form of ...@@ -2069,14 +2069,7 @@ To download artifacts from a job in the current pipeline, use the basic form of
#### Optional `needs` #### Optional `needs`
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30680) in GitLab 13.10. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30680) in GitLab 13.10.
> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default. > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/323891) in GitLab 14.0.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/323891) in GitLab 13.11.
> - Enabled on GitLab.com.
> - Recommended for production use.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-optional-needs). **(FREE SELF)**
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
To need a job that sometimes does not exist in the pipeline, add `optional: true` To need a job that sometimes does not exist in the pipeline, add `optional: true`
to the `needs` configuration. If not defined, `optional: false` is the default. to the `needs` configuration. If not defined, `optional: false` is the default.
...@@ -2110,25 +2103,6 @@ rspec: ...@@ -2110,25 +2103,6 @@ rspec:
optional: true optional: true
``` ```
#### Enable or disable optional needs **(FREE SELF)**
Optional needs is under development but ready for production use.
It is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
can opt to disable it.
To enable it:
```ruby
Feature.enable(:ci_needs_optional)
```
To disable it:
```ruby
Feature.disable(:ci_needs_optional)
```
### `tags` ### `tags`
Use `tags` to select a specific runner from the list of all runners that are Use `tags` to select a specific runner from the list of all runners that are
......
...@@ -35,14 +35,9 @@ module Gitlab ...@@ -35,14 +35,9 @@ module Gitlab
end end
def value def value
if ::Feature.enabled?(:ci_needs_optional, default_enabled: :yaml) { name: @config,
{ name: @config, artifacts: true,
artifacts: true, optional: false }
optional: false }
else
{ name: @config,
artifacts: true }
end
end end
end end
...@@ -66,14 +61,9 @@ module Gitlab ...@@ -66,14 +61,9 @@ module Gitlab
end end
def value def value
if ::Feature.enabled?(:ci_needs_optional, default_enabled: :yaml) { name: job,
{ name: job, artifacts: artifacts || artifacts.nil?,
artifacts: artifacts || artifacts.nil?, optional: !!optional }
optional: !!optional }
else
{ name: job,
artifacts: artifacts || artifacts.nil? }
end
end end
end end
......
...@@ -146,7 +146,7 @@ module Gitlab ...@@ -146,7 +146,7 @@ module Gitlab
end end
@needs_attributes.flat_map do |need| @needs_attributes.flat_map do |need|
next if ::Feature.enabled?(:ci_needs_optional, default_enabled: :yaml) && need[:optional] next if need[:optional]
result = @previous_stages.any? do |stage| result = @previous_stages.any? do |stage|
stage.seeds_names.include?(need[:name]) stage.seeds_names.include?(need[:name])
......
...@@ -25,16 +25,6 @@ RSpec.describe ::Gitlab::Ci::Config::Entry::Need do ...@@ -25,16 +25,6 @@ RSpec.describe ::Gitlab::Ci::Config::Entry::Need do
it 'returns job needs configuration' do it 'returns job needs configuration' do
expect(need.value).to eq(name: 'job_name', artifacts: true, optional: false) expect(need.value).to eq(name: 'job_name', artifacts: true, optional: false)
end end
context 'when the FF ci_needs_optional is disabled' do
before do
stub_feature_flags(ci_needs_optional: false)
end
it 'returns job needs configuration without `optional`' do
expect(need.value).to eq(name: 'job_name', artifacts: true)
end
end
end end
it_behaves_like 'job type' it_behaves_like 'job type'
...@@ -134,16 +124,6 @@ RSpec.describe ::Gitlab::Ci::Config::Entry::Need do ...@@ -134,16 +124,6 @@ RSpec.describe ::Gitlab::Ci::Config::Entry::Need do
it 'returns job needs configuration' do it 'returns job needs configuration' do
expect(need.value).to eq(name: 'job_name', artifacts: true, optional: true) expect(need.value).to eq(name: 'job_name', artifacts: true, optional: true)
end end
context 'when the FF ci_needs_optional is disabled' do
before do
stub_feature_flags(ci_needs_optional: false)
end
it 'returns job needs configuration without `optional`' do
expect(need.value).to eq(name: 'job_name', artifacts: true)
end
end
end end
end end
......
...@@ -1101,17 +1101,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do ...@@ -1101,17 +1101,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
it "does not return an error" do it "does not return an error" do
expect(subject.errors).to be_empty expect(subject.errors).to be_empty
end end
context 'when the FF ci_needs_optional is disabled' do
before do
stub_feature_flags(ci_needs_optional: false)
end
it "returns an error" do
expect(subject.errors).to contain_exactly(
"'rspec' job needs 'build' job, but it was not added to the pipeline")
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