Commit 669b4712 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '300997-remove-ci_workflow_rules_variables' into 'master'

Remove FF ci_workflow_rules_variables

See merge request gitlab-org/gitlab!64557
parents 8158ddba 3e25217f
---
name: ci_workflow_rules_variables
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52085
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/300997
milestone: '13.11'
type: development
group: group::pipeline authoring
default_enabled: true
......@@ -233,15 +233,7 @@ If your rules match both branch pipelines and merge request pipelines,
#### `workflow:rules:variables`
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/294232) in GitLab 13.11.
> - [Deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/300997) in GitLab 13.12.
> - Enabled on GitLab.com.
> - Recommended for production use.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-workflowrulesvariables). **(FREE SELF)**
There can be
[risks when disabling released features](../../user/feature_flags.md#risks-when-disabling-released-features).
Refer to this feature's version history for more details.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/300997) in GitLab 14.1.
You can use [`variables`](#variables) in `workflow:rules:` to define variables for specific pipeline conditions.
......@@ -294,25 +286,6 @@ When the branch is something else:
- job1's `DEPLOY_VARIABLE` is `job1-default-deploy`.
- job2's `DEPLOY_VARIABLE` is `default-deploy`.
##### Enable or disable workflow:rules:variables **(FREE SELF)**
workflow:rules:variables 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_workflow_rules_variables)
```
To disable it:
```ruby
Feature.disable(:ci_workflow_rules_variables)
```
#### `workflow:rules` templates
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/217732) in GitLab 13.0.
......
......@@ -10,10 +10,7 @@ module Gitlab
def perform!
raise ArgumentError, 'missing YAML processor result' unless @command.yaml_processor_result
if ::Feature.enabled?(:ci_workflow_rules_variables, pipeline.project, default_enabled: :yaml)
raise ArgumentError, 'missing workflow rules result' unless @command.workflow_rules_result
end
raise ArgumentError, 'missing workflow rules result' unless @command.workflow_rules_result
# Allocate next IID. This operation must be outside of transactions of pipeline creations.
pipeline.ensure_project_iid!
......@@ -51,13 +48,9 @@ module Gitlab
end
def root_variables
if ::Feature.enabled?(:ci_workflow_rules_variables, pipeline.project, default_enabled: :yaml)
::Gitlab::Ci::Variables::Helpers.merge_variables(
@command.yaml_processor_result.root_variables, @command.workflow_rules_result.variables
)
else
@command.yaml_processor_result.root_variables
end
::Gitlab::Ci::Variables::Helpers.merge_variables(
@command.yaml_processor_result.root_variables, @command.workflow_rules_result.variables
)
end
end
end
......
......@@ -213,8 +213,6 @@ module Gitlab
end
def recalculate_yaml_variables!
return unless ::Feature.enabled?(:ci_workflow_rules_variables, @pipeline.project, default_enabled: :yaml)
@seed_attributes[:yaml_variables] = Gitlab::Ci::Variables::Helpers.inherit_yaml_variables(
from: @context.root_variables, to: @job_variables, inheritance: @root_variables_inheritance
)
......
......@@ -203,18 +203,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Seed do
expect(rspec_variables['VAR1']).to eq('overridden var 1')
end
context 'when the FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'sends root variable' do
run_chain
expect(rspec_variables['VAR1']).to eq('var 1')
end
end
end
context 'N+1 queries' do
......
......@@ -250,19 +250,6 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do
{ key: 'VAR4', value: 'new var pipeline 4', public: true }]
)
end
context 'when FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'returns existing yaml variables' do
expect(subject[:yaml_variables]).to match_array(
[{ key: 'VAR2', value: 'var 2', public: true },
{ key: 'VAR3', value: 'var 3', public: true }]
)
end
end
end
context 'when root_variables_inheritance is false' do
......
......@@ -230,22 +230,6 @@ RSpec.describe Ci::CreatePipelineService do
[nil, nil, nil, 'job var 4', nil, nil, 'overridden var 7']
)
end
context 'when FF ci_workflow_rules_variables is disabled' do
before do
stub_feature_flags(ci_workflow_rules_variables: false)
end
it 'does not affect workflow variables but job variables' do
expect(job1.scoped_variables.to_hash.values_at(*variable_keys)).to eq(
['overridden var 1', 'job var 2', nil, 'workflow var 4', 'job var 5', nil, 'workflow var 7']
)
expect(job2.scoped_variables.to_hash.values_at(*variable_keys)).to eq(
[nil, nil, nil, 'job var 4', nil, nil, 'overridden var 7']
)
end
end
end
context 'when matching to the second rule' 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