Commit dd1a6d26 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'remove-ci-custom-tags-ff-300155' into 'master'

Remove ci_custom_yaml_tags feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!54198
parents 208ddefb 98b94d74
---
title: Add '!reference' YAML tag to help merge CI configurations
merge_request: 54198
author:
type: added
---
name: ci_custom_yaml_tags
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52104
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/300155
milestone: '13.9'
type: development
group: group::pipeline authoring
default_enabled: false
...@@ -4600,13 +4600,6 @@ into templates. ...@@ -4600,13 +4600,6 @@ into templates.
### `!reference` tags ### `!reference` tags
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/266173) in GitLab 13.9. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/266173) in GitLab 13.9.
> - It's [deployed behind a feature flag](../../user/feature_flags.md), disabled by default.
> - It's disabled on GitLab.com.
> - It's not recommended for production use.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-reference-tags). **(FREE SELF)**
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
Use the `!reference` custom YAML tag to select keyword configuration from other job Use the `!reference` custom YAML tag to select keyword configuration from other job
sections and reuse it in the current section. Unlike [YAML anchors](#anchors), you can sections and reuse it in the current section. Unlike [YAML anchors](#anchors), you can
...@@ -4666,25 +4659,6 @@ test-vars-2: ...@@ -4666,25 +4659,6 @@ test-vars-2:
You can't reuse a section that already includes a `!reference` tag. Only one level You can't reuse a section that already includes a `!reference` tag. Only one level
of nesting is supported. of nesting is supported.
#### Enable or disable `!reference` tags **(FREE SELF)**
The `!reference` tag is under development and not ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md)
can enable it.
To enable it:
```ruby
Feature.enable(:ci_custom_yaml_tags)
```
To disable it:
```ruby
Feature.disable(:ci_custom_yaml_tags)
```
## Skip Pipeline ## Skip Pipeline
To push a commit without triggering a pipeline, add `[ci skip]` or `[skip ci]`, using any To push a commit without triggering a pipeline, add `[ci skip]` or `[skip ci]`, using any
......
...@@ -90,15 +90,7 @@ module Gitlab ...@@ -90,15 +90,7 @@ module Gitlab
end end
def build_config(config) def build_config(config)
if ::Feature.enabled?(:ci_custom_yaml_tags, @context.project, default_enabled: :yaml) initial_config = Config::Yaml.load!(config)
build_config_with_custom_tags(config)
else
build_config_without_custom_tags(config)
end
end
def build_config_with_custom_tags(config)
initial_config = Config::Yaml.load!(config, project: @context.project)
initial_config = Config::External::Processor.new(initial_config, @context).perform initial_config = Config::External::Processor.new(initial_config, @context).perform
initial_config = Config::Extendable.new(initial_config).to_hash initial_config = Config::Extendable.new(initial_config).to_hash
initial_config = Config::Yaml::Tags::Resolver.new(initial_config).to_hash initial_config = Config::Yaml::Tags::Resolver.new(initial_config).to_hash
...@@ -107,15 +99,6 @@ module Gitlab ...@@ -107,15 +99,6 @@ module Gitlab
initial_config initial_config
end end
def build_config_without_custom_tags(config)
initial_config = Gitlab::Config::Loader::Yaml.new(config).load!
initial_config = Config::External::Processor.new(initial_config, @context).perform
initial_config = Config::Extendable.new(initial_config).to_hash
initial_config = Config::EdgeStagesInjector.new(initial_config).to_hash
initial_config
end
def build_context(project:, sha:, user:, parent_pipeline:) def build_context(project:, sha:, user:, parent_pipeline:)
Config::External::Context.new( Config::External::Context.new(
project: project, project: project,
......
...@@ -60,11 +60,7 @@ module Gitlab ...@@ -60,11 +60,7 @@ module Gitlab
def content_hash def content_hash
strong_memoize(:content_yaml) do strong_memoize(:content_yaml) do
if ::Feature.enabled?(:ci_custom_yaml_tags, context.project, default_enabled: :yaml)
::Gitlab::Ci::Config::Yaml.load!(content) ::Gitlab::Ci::Config::Yaml.load!(content)
else
Gitlab::Config::Loader::Yaml.new(content).load!
end
end end
rescue Gitlab::Config::Loader::FormatError rescue Gitlab::Config::Loader::FormatError
nil nil
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
AVAILABLE_TAGS = [Config::Yaml::Tags::Reference].freeze AVAILABLE_TAGS = [Config::Yaml::Tags::Reference].freeze
class << self class << self
def load!(content, project: nil) def load!(content)
ensure_custom_tags ensure_custom_tags
Gitlab::Config::Loader::Yaml.new(content, additional_permitted_classes: AVAILABLE_TAGS).load! Gitlab::Config::Loader::Yaml.new(content, additional_permitted_classes: AVAILABLE_TAGS).load!
......
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