summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config')
-rw-r--r--lib/gitlab/ci/config/entry/environment.rb2
-rw-r--r--lib/gitlab/ci/config/entry/job.rb20
-rw-r--r--lib/gitlab/ci/config/entry/reports.rb6
-rw-r--r--lib/gitlab/ci/config/entry/root.rb23
-rw-r--r--lib/gitlab/ci/config/extendable/entry.rb2
-rw-r--r--lib/gitlab/ci/config/external/file/local.rb20
-rw-r--r--lib/gitlab/ci/config/external/file/project.rb24
-rw-r--r--lib/gitlab/ci/config/external/file/remote.rb2
-rw-r--r--lib/gitlab/ci/config/external/file/template.rb11
9 files changed, 62 insertions, 48 deletions
diff --git a/lib/gitlab/ci/config/entry/environment.rb b/lib/gitlab/ci/config/entry/environment.rb
index 2066e9be3b1..bc39abfe977 100644
--- a/lib/gitlab/ci/config/entry/environment.rb
+++ b/lib/gitlab/ci/config/entry/environment.rb
@@ -44,7 +44,7 @@ module Gitlab
validates :action,
type: String,
- inclusion: { in: %w[start stop prepare], message: 'should be start, stop or prepare' },
+ inclusion: { in: %w[start stop prepare verify access], message: 'should be start, stop, prepare, verify, or access' },
allow_nil: true
validates :deployment_tier,
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 06c81fd65dd..7513936a18a 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -11,7 +11,7 @@ module Gitlab
include ::Gitlab::Ci::Config::Entry::Processable
ALLOWED_WHEN = %w[on_success on_failure always manual delayed].freeze
- ALLOWED_KEYS = %i[tags script type image services start_in artifacts
+ ALLOWED_KEYS = %i[tags script image services start_in artifacts
cache dependencies before_script after_script
environment coverage retry parallel interruptible timeout
release].freeze
@@ -55,11 +55,6 @@ module Gitlab
description: 'Commands that will be executed in this job.',
inherit: false
- entry :type, Entry::Stage,
- description: 'Deprecated: stage this job will be executed into.',
- inherit: false,
- deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0' }
-
entry :after_script, Entry::Commands,
description: 'Commands that will be executed when finishing job.',
inherit: true
@@ -135,19 +130,6 @@ module Gitlab
true
end
- 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)
- end
- end
-
def delayed?
self.when == 'delayed'
end
diff --git a/lib/gitlab/ci/config/entry/reports.rb b/lib/gitlab/ci/config/entry/reports.rb
index f8fce1abc06..d5d204bb995 100644
--- a/lib/gitlab/ci/config/entry/reports.rb
+++ b/lib/gitlab/ci/config/entry/reports.rb
@@ -15,7 +15,7 @@ module Gitlab
ALLOWED_KEYS =
%i[junit codequality sast secret_detection dependency_scanning container_scanning
dast performance browser_performance load_performance license_scanning metrics lsif
- dotenv cobertura terraform accessibility cluster_applications
+ dotenv terraform accessibility
requirements coverage_fuzzing api_fuzzing cluster_image_scanning
coverage_report].freeze
@@ -45,14 +45,10 @@ module Gitlab
validates :metrics, array_of_strings_or_string: true
validates :lsif, array_of_strings_or_string: true
validates :dotenv, array_of_strings_or_string: true
- validates :cobertura, array_of_strings_or_string: true
validates :terraform, array_of_strings_or_string: true
validates :accessibility, array_of_strings_or_string: true
- validates :cluster_applications, array_of_strings_or_string: true # DEPRECATED: https://gitlab.com/gitlab-org/gitlab/-/issues/333441
validates :requirements, array_of_strings_or_string: true
end
-
- validates :config, mutually_exclusive_keys: [:coverage_report, :cobertura]
end
def value
diff --git a/lib/gitlab/ci/config/entry/root.rb b/lib/gitlab/ci/config/entry/root.rb
index 7b58ef0b8ab..ff11c757dfa 100644
--- a/lib/gitlab/ci/config/entry/root.rb
+++ b/lib/gitlab/ci/config/entry/root.rb
@@ -12,7 +12,7 @@ module Gitlab
include ::Gitlab::Config::Entry::Configurable
ALLOWED_KEYS = %i[default include before_script image services
- after_script variables stages types cache workflow].freeze
+ after_script variables stages cache workflow].freeze
validations do
validates :config, allowed_keys: ALLOWED_KEYS
@@ -57,11 +57,6 @@ module Gitlab
description: 'Configuration of stages for this pipeline.',
reserved: true
- entry :types, Entry::Stages,
- description: 'Deprecated: stages for this pipeline.',
- reserved: true,
- deprecation: { deprecated: '9.0', warning: '14.8', removed: '15.0' }
-
entry :cache, Entry::Caches,
description: 'Configure caching between build jobs.',
reserved: true
@@ -100,7 +95,6 @@ module Gitlab
def compose!(_deps = nil)
super(self) do
- compose_deprecated_entries!
compose_jobs!
end
end
@@ -118,21 +112,6 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
- def compose_deprecated_entries!
- ##
- # 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?
- log_and_warn_deprecated_entry(@entries[:types])
- end
-
- @entries.delete(:types)
- end
-
def filter_jobs!
return unless @config.is_a?(Hash)
diff --git a/lib/gitlab/ci/config/extendable/entry.rb b/lib/gitlab/ci/config/extendable/entry.rb
index 0001a259281..169d329fe02 100644
--- a/lib/gitlab/ci/config/extendable/entry.rb
+++ b/lib/gitlab/ci/config/extendable/entry.rb
@@ -99,7 +99,7 @@ module Gitlab
end
def circular_dependency?
- ancestors.include?(key)
+ ancestors.include?(key) # rubocop:disable Performance/AncestorsInclude
end
def unknown_extensions
diff --git a/lib/gitlab/ci/config/external/file/local.rb b/lib/gitlab/ci/config/external/file/local.rb
index ee9cc1552fe..feb2cbb19ad 100644
--- a/lib/gitlab/ci/config/external/file/local.rb
+++ b/lib/gitlab/ci/config/external/file/local.rb
@@ -23,6 +23,8 @@ module Gitlab
super.merge(
type: :local,
location: masked_location,
+ blob: masked_blob,
+ raw: masked_raw,
extra: {}
)
end
@@ -57,6 +59,24 @@ module Gitlab
variables: context.variables
}
end
+
+ def masked_blob
+ strong_memoize(:masked_blob) do
+ context.mask_variables_from(
+ Gitlab::Routing.url_helpers.project_blob_url(context.project, ::File.join(context.sha, location))
+ )
+ end
+ end
+
+ def masked_raw
+ return unless context.project
+
+ strong_memoize(:masked_raw) do
+ context.mask_variables_from(
+ Gitlab::Routing.url_helpers.project_raw_url(context.project, ::File.join(context.sha, location))
+ )
+ end
+ end
end
end
end
diff --git a/lib/gitlab/ci/config/external/file/project.rb b/lib/gitlab/ci/config/external/file/project.rb
index 3d4436530a8..09c36a1bcb6 100644
--- a/lib/gitlab/ci/config/external/file/project.rb
+++ b/lib/gitlab/ci/config/external/file/project.rb
@@ -31,6 +31,8 @@ module Gitlab
super.merge(
type: :file,
location: masked_location,
+ blob: masked_blob,
+ raw: masked_raw,
extra: { project: masked_project_name, ref: masked_ref_name }
)
end
@@ -69,6 +71,8 @@ module Gitlab
end
def sha
+ return unless project
+
strong_memoize(:sha) do
project.commit(ref_name).try(:sha)
end
@@ -96,6 +100,26 @@ module Gitlab
context.mask_variables_from(ref_name)
end
end
+
+ def masked_blob
+ return unless project
+
+ strong_memoize(:masked_blob) do
+ context.mask_variables_from(
+ Gitlab::Routing.url_helpers.project_blob_url(project, ::File.join(sha, location))
+ )
+ end
+ end
+
+ def masked_raw
+ return unless project
+
+ strong_memoize(:masked_raw) do
+ context.mask_variables_from(
+ Gitlab::Routing.url_helpers.project_raw_url(project, ::File.join(sha, location))
+ )
+ end
+ end
end
end
end
diff --git a/lib/gitlab/ci/config/external/file/remote.rb b/lib/gitlab/ci/config/external/file/remote.rb
index e7b007b4d8d..7d3a2362246 100644
--- a/lib/gitlab/ci/config/external/file/remote.rb
+++ b/lib/gitlab/ci/config/external/file/remote.rb
@@ -22,6 +22,8 @@ module Gitlab
super.merge(
type: :remote,
location: masked_location,
+ blob: nil,
+ raw: masked_location,
extra: {}
)
end
diff --git a/lib/gitlab/ci/config/external/file/template.rb b/lib/gitlab/ci/config/external/file/template.rb
index 9469f09ce13..58b81b259cb 100644
--- a/lib/gitlab/ci/config/external/file/template.rb
+++ b/lib/gitlab/ci/config/external/file/template.rb
@@ -9,6 +9,7 @@ module Gitlab
attr_reader :location
SUFFIX = '.gitlab-ci.yml'
+ HOST = 'https://gitlab.com/gitlab-org/gitlab/-/raw/master'
def initialize(params, context)
@location = params[:template]
@@ -24,6 +25,8 @@ module Gitlab
super.merge(
type: :template,
location: masked_location,
+ blob: nil,
+ raw: masked_raw,
extra: {}
)
end
@@ -51,6 +54,14 @@ module Gitlab
def fetch_template_content
Gitlab::Template::GitlabCiYmlTemplate.find(template_name, context.project)&.content
end
+
+ def masked_raw
+ strong_memoize(:masked_raw) do
+ context.mask_variables_from(
+ "#{HOST}/#{Gitlab::Template::GitlabCiYmlTemplate::BASE_DIR}/#{location}"
+ )
+ end
+ end
end
end
end