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:
Diffstat (limited to 'lib/gitlab/config/entry/node.rb')
-rw-r--r--lib/gitlab/config/entry/node.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/gitlab/config/entry/node.rb b/lib/gitlab/config/entry/node.rb
index 32912cb1046..6ce7046262b 100644
--- a/lib/gitlab/config/entry/node.rb
+++ b/lib/gitlab/config/entry/node.rb
@@ -10,7 +10,7 @@ module Gitlab
InvalidError = Class.new(StandardError)
attr_reader :config, :metadata
- attr_accessor :key, :parent, :default, :description
+ attr_accessor :key, :parent, :default, :description, :deprecation
def initialize(config, **metadata)
@config = config
@@ -128,6 +128,24 @@ module Gitlab
private
attr_reader :entries
+
+ def log_and_warn_deprecated_entry(entry)
+ user = metadata[:user]
+ project = metadata[:project]
+
+ if project && user
+ Gitlab::AppJsonLogger.info(event: 'ci_used_deprecated_keyword',
+ entry: entry.key.to_s,
+ user_id: user.id,
+ project_id: project.id)
+ end
+
+ deprecation = entry.deprecation
+ add_warning(
+ "`#{entry.key}` is deprecated in " \
+ "#{deprecation[:deprecated]} and will be removed in #{deprecation[:removed]}."
+ )
+ end
end
end
end