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/experiment/rollout/feature.rb')
-rw-r--r--lib/gitlab/experiment/rollout/feature.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/gitlab/experiment/rollout/feature.rb b/lib/gitlab/experiment/rollout/feature.rb
index 5a14e3c272e..70c363877b1 100644
--- a/lib/gitlab/experiment/rollout/feature.rb
+++ b/lib/gitlab/experiment/rollout/feature.rb
@@ -12,10 +12,11 @@ module Gitlab
# - not have rolled out the feature flag at all (no percent of actors,
# no inclusions, etc.)
def enabled?
- return false if ::Feature::Definition.get(feature_flag_name).nil?
- return false unless Gitlab.dev_env_or_com?
+ return false unless feature_flag_defined?
+ return false unless Gitlab.com?
+ return false unless ::Feature.enabled?(:gitlab_experiment, type: :ops, default_enabled: :yaml)
- ::Feature.get(feature_flag_name).state != :off # rubocop:disable Gitlab/AvoidFeatureGet
+ feature_flag_instance.state != :off
end
# For assignment we first check to see if our feature flag is enabled
@@ -58,6 +59,14 @@ module Gitlab
private
+ def feature_flag_instance
+ ::Feature.get(feature_flag_name) # rubocop:disable Gitlab/AvoidFeatureGet
+ end
+
+ def feature_flag_defined?
+ ::Feature::Definition.get(feature_flag_name).present?
+ end
+
def feature_flag_name
experiment.name.tr('/', '_')
end