Commit 4b939871 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'jivanvl-remove-raise-job-rules-warning-ff' into 'master'

Raise job rules without workflow warnings by default [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61945
parents 12370f3d bf779d0b
---
name: ci_raise_job_rules_without_workflow_rules_warning
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38387
rollout_issue_url:
milestone: '13.3'
type: development
group: group::continuous integration
default_enabled: true
...@@ -98,7 +98,6 @@ module Gitlab ...@@ -98,7 +98,6 @@ module Gitlab
def validate_against_warnings def validate_against_warnings
# If rules are valid format and workflow rules are not specified # If rules are valid format and workflow rules are not specified
return unless rules_value return unless rules_value
return unless Gitlab::Ci::Features.raise_job_rules_without_workflow_rules_warning?
last_rule = rules_value.last last_rule = rules_value.last
......
...@@ -22,10 +22,6 @@ module Gitlab ...@@ -22,10 +22,6 @@ module Gitlab
Feature.enabled?(:merge_base_pipeline_for_metrics_comparison, project, default_enabled: :yaml) Feature.enabled?(:merge_base_pipeline_for_metrics_comparison, project, default_enabled: :yaml)
end end
def self.raise_job_rules_without_workflow_rules_warning?
::Feature.enabled?(:ci_raise_job_rules_without_workflow_rules_warning, default_enabled: true)
end
# NOTE: The feature flag `disallow_to_create_merge_request_pipelines_in_target_project` # NOTE: The feature flag `disallow_to_create_merge_request_pipelines_in_target_project`
# is a safe switch to disable the feature for a particular project when something went wrong, # is a safe switch to disable the feature for a particular project when something went wrong,
# therefore it's not supposed to be enabled by default. # therefore it's not supposed to be enabled by default.
......
...@@ -271,10 +271,8 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do ...@@ -271,10 +271,8 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
context 'when workflow rules is not used' do context 'when workflow rules is not used' do
let(:workflow) { double('workflow', 'has_rules?' => false) } let(:workflow) { double('workflow', 'has_rules?' => false) }
let(:feature_flag_value) { true }
before do before do
stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: feature_flag_value)
entry.compose!(deps) entry.compose!(deps)
end end
...@@ -298,12 +296,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do ...@@ -298,12 +296,6 @@ RSpec.describe Gitlab::Ci::Config::Entry::Processable do
it 'raises a warning' do it 'raises a warning' do
expect(entry.warnings).to contain_exactly(/may allow multiple pipelines/) expect(entry.warnings).to contain_exactly(/may allow multiple pipelines/)
end end
context 'when feature flag is disabled' do
let(:feature_flag_value) { false }
it_behaves_like 'has no warnings'
end
end end
context 'and its value is `never`' do context 'and its value is `never`' do
......
...@@ -485,10 +485,6 @@ module Gitlab ...@@ -485,10 +485,6 @@ module Gitlab
end end
describe '#warnings' do describe '#warnings' do
before do
stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: true)
end
context 'when a warning is raised in a given entry' do context 'when a warning is raised in a given entry' do
let(:config) do let(:config) do
<<-EOYML <<-EOYML
...@@ -602,27 +598,6 @@ module Gitlab ...@@ -602,27 +598,6 @@ module Gitlab
it_behaves_like 'has warnings and expected error', /build job: need test is not defined in prior stages/ it_behaves_like 'has warnings and expected error', /build job: need test is not defined in prior stages/
end end
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: false)
end
context 'job rules used without workflow rules' do
let(:config) do
<<-EOYML
rspec:
script: rspec
rules:
- when: always
EOYML
end
it 'does not raise the warning' do
expect(subject.warnings).to be_empty
end
end
end
end end
describe 'only / except policies validations' do describe 'only / except policies validations' do
......
...@@ -14,7 +14,6 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -14,7 +14,6 @@ RSpec.describe Ci::CreatePipelineService do
before do before do
stub_ci_pipeline_yaml_file(config) stub_ci_pipeline_yaml_file(config)
stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: true)
end end
context 'when created successfully' do context 'when created successfully' do
...@@ -35,18 +34,6 @@ RSpec.describe Ci::CreatePipelineService do ...@@ -35,18 +34,6 @@ RSpec.describe Ci::CreatePipelineService do
/jobs:test may allow multiple pipelines to run/ /jobs:test may allow multiple pipelines to run/
) )
end end
context 'when feature flag is disabled for the particular warning' do
before do
stub_feature_flags(ci_raise_job_rules_without_workflow_rules_warning: false)
end
it 'does not contain warnings' do
expect(pipeline.error_messages.map(&:content)).to be_empty
expect(pipeline.warning_messages.map(&:content)).to be_empty
end
end
end end
context 'when no warnings are raised' do context 'when no warnings are raised' 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