Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 12:40:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-10-20 12:40:42 +0300
commitee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch)
treef8479f94a28f66654c6a4f6fb99bad6b4e86a40e /lib/gitlab/config
parent62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff)
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'lib/gitlab/config')
-rw-r--r--lib/gitlab/config/entry/legacy_validation_helpers.rb14
-rw-r--r--lib/gitlab/config/entry/validators.rb11
2 files changed, 1 insertions, 24 deletions
diff --git a/lib/gitlab/config/entry/legacy_validation_helpers.rb b/lib/gitlab/config/entry/legacy_validation_helpers.rb
index be7d26fed4e..415f6f77214 100644
--- a/lib/gitlab/config/entry/legacy_validation_helpers.rb
+++ b/lib/gitlab/config/entry/legacy_validation_helpers.rb
@@ -50,12 +50,6 @@ module Gitlab
variables.values.flatten(1).all?(&method(:validate_alphanumeric))
end
- def validate_string_or_hash_value_variables(variables, allowed_value_data)
- variables.is_a?(Hash) &&
- variables.keys.all?(&method(:validate_alphanumeric)) &&
- variables.values.all? { |value| validate_string_or_hash_value_variable(value, allowed_value_data) }
- end
-
def validate_alphanumeric(value)
validate_string(value) || validate_integer(value)
end
@@ -68,14 +62,6 @@ module Gitlab
value.is_a?(String) || value.is_a?(Symbol)
end
- def validate_string_or_hash_value_variable(value, allowed_value_data)
- if value.is_a?(Hash)
- (value.keys - allowed_value_data).empty? && value.values.all?(&method(:validate_alphanumeric))
- else
- validate_alphanumeric(value)
- end
- end
-
def validate_regexp(value)
Gitlab::UntrustedRegexp::RubySyntax.valid?(value)
end
diff --git a/lib/gitlab/config/entry/validators.rb b/lib/gitlab/config/entry/validators.rb
index 337cfbc5287..b88a6766d92 100644
--- a/lib/gitlab/config/entry/validators.rb
+++ b/lib/gitlab/config/entry/validators.rb
@@ -44,7 +44,7 @@ module Gitlab
mutually_exclusive_keys = value.try(:keys).to_a & options[:in]
if mutually_exclusive_keys.length > 1
- record.errors.add(attribute, "please use only one the following keys: " +
+ record.errors.add(attribute, "please use only one of the following keys: " +
mutually_exclusive_keys.join(', '))
end
end
@@ -304,15 +304,12 @@ module Gitlab
end
end
- # This will be removed with the FF `ci_variables_refactoring_to_variable`.
class VariablesValidator < ActiveModel::EachValidator
include LegacyValidationHelpers
def validate_each(record, attribute, value)
if options[:array_values]
validate_key_array_values(record, attribute, value)
- elsif options[:allowed_value_data]
- validate_key_hash_values(record, attribute, value, options[:allowed_value_data])
else
validate_key_values(record, attribute, value)
end
@@ -329,12 +326,6 @@ module Gitlab
record.errors.add(attribute, 'should be a hash of key value pairs, value can be an array')
end
end
-
- def validate_key_hash_values(record, attribute, value, allowed_value_data)
- unless validate_string_or_hash_value_variables(value, allowed_value_data)
- record.errors.add(attribute, 'should be a hash of key value pairs, value can be a hash')
- end
- end
end
class AlphanumericValidator < ActiveModel::EachValidator