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>2021-12-20 16:37:47 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-12-20 16:37:47 +0300
commitaee0a117a889461ce8ced6fcf73207fe017f1d99 (patch)
tree891d9ef189227a8445d83f35c1b0fc99573f4380 /lib/feature
parent8d46af3258650d305f53b819eabf7ab18d22f59e (diff)
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'lib/feature')
-rw-r--r--lib/feature/definition.rb18
-rw-r--r--lib/feature/shared.rb1
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/feature/definition.rb b/lib/feature/definition.rb
index cd2f5cb07a2..61f7e395769 100644
--- a/lib/feature/definition.rb
+++ b/lib/feature/definition.rb
@@ -82,6 +82,16 @@ class Feature
attributes
end
+ def for_upcoming_milestone?
+ return false unless milestone
+
+ Gitlab::VersionInfo.parse(milestone + '.999') >= Gitlab.version_info
+ end
+
+ def force_log_state_changes?
+ attributes[:log_state_changes]
+ end
+
class << self
def paths
@paths ||= [Rails.root.join('config', 'feature_flags', '**', '*.yml')]
@@ -106,6 +116,14 @@ class Feature
definitions.has_key?(key.to_sym)
end
+ def log_states?(key)
+ return false if key == :feature_flag_state_logs
+ return false if Feature.disabled?(:feature_flag_state_logs, type: :ops)
+ return false unless (feature = get(key))
+
+ feature.force_log_state_changes? || feature.for_upcoming_milestone?
+ end
+
def valid_usage!(key, type:, default_enabled:)
if definition = get(key)
definition.valid_usage!(type_in_code: type, default_enabled_in_code: default_enabled)
diff --git a/lib/feature/shared.rb b/lib/feature/shared.rb
index 70e5b523adf..2ce078b2f02 100644
--- a/lib/feature/shared.rb
+++ b/lib/feature/shared.rb
@@ -58,6 +58,7 @@ class Feature
introduced_by_url
rollout_issue_url
milestone
+ log_state_changes
type
group
default_enabled