diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-02 18:16:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-02 18:16:07 +0300 |
commit | f38683df1f619b2a1960e1415b9326354a4b5327 (patch) | |
tree | 23d469a81d3d1866a2ab71ba406aa84cd954f99a /lib/gitlab/experiment | |
parent | 5bc7c18ad37cde0ffdf1aa4ba2cee27c92ec69f6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/experiment')
-rw-r--r-- | lib/gitlab/experiment/rollout/feature.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/gitlab/experiment/rollout/feature.rb b/lib/gitlab/experiment/rollout/feature.rb index 5a14e3c272e..c24f2a23862 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 feature_flag_defined? return false unless Gitlab.dev_env_or_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 |