summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 09:45:46 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-18 09:45:46 +0000
commita7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch)
tree7452bd5c3545c2fa67a28aa013835fb4fa071baf /lib/gitlab/ci/config
parentee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff)
downloadgitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'lib/gitlab/ci/config')
-rw-r--r--lib/gitlab/ci/config/entry/default.rb4
-rw-r--r--lib/gitlab/ci/config/entry/job.rb10
-rw-r--r--lib/gitlab/ci/config/entry/jobs.rb2
-rw-r--r--lib/gitlab/ci/config/entry/root.rb8
-rw-r--r--lib/gitlab/ci/config/entry/script.rb24
-rw-r--r--lib/gitlab/ci/config/external/mapper.rb14
6 files changed, 20 insertions, 42 deletions
diff --git a/lib/gitlab/ci/config/entry/default.rb b/lib/gitlab/ci/config/entry/default.rb
index 145772c7a92..12d68b755b3 100644
--- a/lib/gitlab/ci/config/entry/default.rb
+++ b/lib/gitlab/ci/config/entry/default.rb
@@ -21,7 +21,7 @@ module Gitlab
validates :config, allowed_keys: ALLOWED_KEYS
end
- entry :before_script, Entry::Script,
+ entry :before_script, Entry::Commands,
description: 'Script that will be executed before each job.',
inherit: true
@@ -33,7 +33,7 @@ module Gitlab
description: 'Docker images that will be linked to the container.',
inherit: true
- entry :after_script, Entry::Script,
+ entry :after_script, Entry::Commands,
description: 'Script that will be executed after each job.',
inherit: true
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 75bbe2ccb1b..8dd1f686132 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -45,7 +45,7 @@ module Gitlab
end
end
- entry :before_script, Entry::Script,
+ entry :before_script, Entry::Commands,
description: 'Global before script overridden in this job.',
inherit: true
@@ -55,9 +55,10 @@ module Gitlab
entry :type, Entry::Stage,
description: 'Deprecated: stage this job will be executed into.',
- inherit: false
+ inherit: false,
+ deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0' }
- entry :after_script, Entry::Script,
+ entry :after_script, Entry::Commands,
description: 'Commands that will be executed when finishing job.',
inherit: true
@@ -134,8 +135,11 @@ module Gitlab
def compose!(deps = nil)
super do
+ # The type keyword will be removed in 15.0:
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/346823
if type_defined? && !stage_defined?
@entries[:stage] = @entries[:type]
+ log_and_warn_deprecated_entry(@entries[:type])
end
@entries.delete(:type)
diff --git a/lib/gitlab/ci/config/entry/jobs.rb b/lib/gitlab/ci/config/entry/jobs.rb
index b0fd9cef10b..d2a25d59669 100644
--- a/lib/gitlab/ci/config/entry/jobs.rb
+++ b/lib/gitlab/ci/config/entry/jobs.rb
@@ -15,7 +15,7 @@ module Gitlab
validate do
each_unmatched_job do |name|
- errors.add(name, 'config should implement a script: or a trigger: keyword')
+ errors.add(name.to_s, 'config should implement a script: or a trigger: keyword')
end
unless has_visible_job?
diff --git a/lib/gitlab/ci/config/entry/root.rb b/lib/gitlab/ci/config/entry/root.rb
index 41a3c87037b..7b58ef0b8ab 100644
--- a/lib/gitlab/ci/config/entry/root.rb
+++ b/lib/gitlab/ci/config/entry/root.rb
@@ -32,7 +32,7 @@ module Gitlab
description: 'List of external YAML files to include.',
reserved: true
- entry :before_script, Entry::Script,
+ entry :before_script, Entry::Commands,
description: 'Script that will be executed before each job.',
reserved: true
@@ -44,7 +44,7 @@ module Gitlab
description: 'Docker images that will be linked to the container.',
reserved: true
- entry :after_script, Entry::Script,
+ entry :after_script, Entry::Commands,
description: 'Script that will be executed after each job.',
reserved: true
@@ -60,7 +60,7 @@ module Gitlab
entry :types, Entry::Stages,
description: 'Deprecated: stages for this pipeline.',
reserved: true,
- deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0', documentation: 'https://docs.gitlab.com/ee/ci/yaml/#deprecated-keywords' }
+ deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0' }
entry :cache, Entry::Caches,
description: 'Configure caching between build jobs.',
@@ -122,6 +122,8 @@ module Gitlab
##
# Deprecated `:types` key workaround - if types are defined and
# stages are not defined we use types definition as stages.
+ # This keyword will be removed in 15.0:
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/346823
#
if types_defined?
@entries[:stages] = @entries[:types] unless stages_defined?
diff --git a/lib/gitlab/ci/config/entry/script.rb b/lib/gitlab/ci/config/entry/script.rb
deleted file mode 100644
index 285e18218b3..00000000000
--- a/lib/gitlab/ci/config/entry/script.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Ci
- class Config
- module Entry
- ##
- # Entry that represents a script.
- #
- class Script < ::Gitlab::Config::Entry::Node
- include ::Gitlab::Config::Entry::Validatable
-
- validations do
- validates :config, nested_array_of_strings: true
- end
-
- def value
- config.flatten(1)
- end
- end
- end
- end
- end
-end
diff --git a/lib/gitlab/ci/config/external/mapper.rb b/lib/gitlab/ci/config/external/mapper.rb
index a5bf066c81f..7f1de6ce1ab 100644
--- a/lib/gitlab/ci/config/external/mapper.rb
+++ b/lib/gitlab/ci/config/external/mapper.rb
@@ -19,7 +19,6 @@ module Gitlab
Error = Class.new(StandardError)
AmbigiousSpecificationError = Class.new(Error)
- DuplicateIncludesError = Class.new(Error)
TooManyIncludesError = Class.new(Error)
def initialize(values, context)
@@ -114,25 +113,22 @@ module Gitlab
def verify_duplicates!(location)
logger.instrument(:config_mapper_verify) do
- verify_duplicates_without_instrumentation!(location)
+ verify_max_includes_and_add_location!(location)
end
end
- def verify_duplicates_without_instrumentation!(location)
+ def verify_max_includes_and_add_location!(location)
if expandset.count >= MAX_INCLUDES
raise TooManyIncludesError, "Maximum of #{MAX_INCLUDES} nested includes are allowed!"
end
- # We scope location to context, as this allows us to properly support
- # relative includes, and similarly looking relative in another project
- # does not trigger duplicate error
+ # Scope location to context to allow support of
+ # relative includes
scoped_location = location.merge(
context_project: context.project,
context_sha: context.sha)
- unless expandset.add?(scoped_location)
- raise DuplicateIncludesError, "Include `#{location.to_json}` was already included!"
- end
+ expandset.add(scoped_location)
end
def select_first_matching(location)