Commit 4b35fcc6 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'revert-599ff623' into 'master'

Revert !50312 into 'master'" [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!50903
parents e6ebfd93 579baf6b
---
name: ci_notification_dot_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27626
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/101
milestone: '12.10'
type: experiment
group: group::expansion
default_enabled: false
---
name: ci_syntax_templates_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48141
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/281057
milestone: '13.8'
type: experiment
group: group::activation
default_enabled: false
---
name: contact_sales_btn_in_app_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38508
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238207
milestone: '13.3'
type: experiment
group: group::conversion
default_enabled: true
---
name: customize_homepage_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39348
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/187
milestone: '13.4'
type: experiment
group: group::expansion
default_enabled: false
---
name: default_to_issues_board_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43939
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/268298
milestone: '13.5'
type: experiment
group: group::conversion
default_enabled: true
---
name: group_only_trials_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40564
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/258629
milestone: '13.5'
type: experiment
group: group::conversion
default_enabled: false
---
name: invite_members_empty_group_version_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45689
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/280
milestone: '13.6'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_empty_project_version_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49588
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262014
milestone: '13.7'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_new_dropdown_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50069
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/268129
milestone: '13.8'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_version_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45689/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/219239
milestone: '13.6'
type: experiment
group: group::expansion
default_enabled: false
---
name: invite_members_version_b_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43900
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/214
milestone: '13.5'
type: experiment
group: group::expansion
default_enabled: false
---
name: jobs_empty_state_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48686
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/281054
milestone: '13.7'
type: experiment
group: group::activation
default_enabled: false
---
name: onboarding_issues_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31656/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/224515
milestone: '13.0'
type: experiment
group: group::conversion
default_enabled: true
---
name: pipelines_empty_state_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47952
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/289
milestone: '13.8'
type: experiment
group: group::activation
default_enabled: false
---
name: remove_known_trial_form_fields_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45634/
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/281
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
---
name: trial_during_signup_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45147/
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/251231
milestone: '13.8'
type: experiment
group: group::conversion
default_enabled: false
---
name: trial_onboarding_issues_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48052
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/276703
milestone: '13.8'
type: experiment
group: group::conversion
default_enabled: false
---
name: trial_registration_with_social_signin_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45633
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/262853
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
---
name: trimmed_skip_trial_copy_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48110
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/284956
milestone: '13.7'
type: experiment
group: group::conversion
default_enabled: false
---
name: upgrade_link_in_user_menu_a_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29428
rollout_issue_url: https://gitlab.com/gitlab-org/growth/team-tasks/-/issues/126
milestone: '13.0'
type: experiment
group: group::expansion
default_enabled: false
...@@ -20,8 +20,6 @@ RSpec.describe API::Experiments do ...@@ -20,8 +20,6 @@ RSpec.describe API::Experiments do
end end
before do before do
skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
stub_const('Gitlab::Experimentation::EXPERIMENTS', experiments) stub_const('Gitlab::Experimentation::EXPERIMENTS', experiments)
Feature.enable_percentage_of_time('experiment_1_experiment_percentage', 10) Feature.enable_percentage_of_time('experiment_1_experiment_percentage', 10)
Feature.disable('experiment_2_experiment_percentage') Feature.disable('experiment_2_experiment_percentage')
......
...@@ -57,8 +57,6 @@ class Feature ...@@ -57,8 +57,6 @@ class Feature
default_enabled: false, default_enabled: false,
example: <<-EOS example: <<-EOS
experiment(:my_experiment, project: project, actor: current_user) { ...variant code... } experiment(:my_experiment, project: project, actor: current_user) { ...variant code... }
# or
Gitlab::Experimentation.in_experiment_group?(:my_experiment, subject: current_user)
EOS EOS
} }
}.freeze }.freeze
......
...@@ -3,21 +3,17 @@ ...@@ -3,21 +3,17 @@
module Gitlab module Gitlab
module Experimentation module Experimentation
class Experiment class Experiment
FEATURE_FLAG_SUFFIX = "_experiment_percentage"
attr_reader :key, :tracking_category, :use_backwards_compatible_subject_index attr_reader :key, :tracking_category, :use_backwards_compatible_subject_index
def initialize(key, **params) def initialize(key, **params)
@key = key @key = key
@tracking_category = params[:tracking_category] @tracking_category = params[:tracking_category]
@use_backwards_compatible_subject_index = params[:use_backwards_compatible_subject_index] @use_backwards_compatible_subject_index = params[:use_backwards_compatible_subject_index]
@experiment_percentage = Feature.get(:"#{key}_experiment_percentage").percentage_of_time_value # rubocop:disable Gitlab/AvoidFeatureGet
end end
def active? def active?
# TODO: just touch a feature flag
# Temporary change, we will change `experiment_percentage` in future to `Feature.enabled?
Feature.enabled?(feature_flag_name, type: :experiment, default_enabled: :yaml)
::Gitlab.dev_env_or_com? && experiment_percentage > 0 ::Gitlab.dev_env_or_com? && experiment_percentage > 0
end end
...@@ -29,17 +25,7 @@ module Gitlab ...@@ -29,17 +25,7 @@ module Gitlab
private private
def experiment_percentage attr_reader :experiment_percentage
feature_flag.percentage_of_time_value
end
def feature_flag
Feature.get(feature_flag_name) # rubocop:disable Gitlab/AvoidFeatureGet
end
def feature_flag_name
:"#{key}#{FEATURE_FLAG_SUFFIX}"
end
end end
end end
end end
...@@ -14,10 +14,8 @@ RSpec.describe Gitlab::Experimentation::Experiment do ...@@ -14,10 +14,8 @@ RSpec.describe Gitlab::Experimentation::Experiment do
end end
before do before do
skip_feature_flags_yaml_validation feature = double('FeatureFlag', percentage_of_time_value: percentage )
skip_default_enabled_yaml_check expect(Feature).to receive(:get).with(:experiment_key_experiment_percentage).and_return(feature)
feature = double('FeatureFlag', percentage_of_time_value: percentage, enabled?: true)
allow(Feature).to receive(:get).with(:experiment_key_experiment_percentage).and_return(feature)
end end
subject(:experiment) { described_class.new(:experiment_key, **params) } subject(:experiment) { described_class.new(:experiment_key, **params) }
......
...@@ -38,8 +38,6 @@ RSpec.describe Gitlab::Experimentation do ...@@ -38,8 +38,6 @@ RSpec.describe Gitlab::Experimentation do
} }
}) })
skip_feature_flags_yaml_validation
skip_default_enabled_yaml_check
Feature.enable_percentage_of_time(:backwards_compatible_test_experiment_experiment_percentage, enabled_percentage) Feature.enable_percentage_of_time(:backwards_compatible_test_experiment_experiment_percentage, enabled_percentage)
Feature.enable_percentage_of_time(:test_experiment_experiment_percentage, enabled_percentage) Feature.enable_percentage_of_time(:test_experiment_experiment_percentage, enabled_percentage)
allow(Gitlab).to receive(:com?).and_return(true) allow(Gitlab).to receive(:com?).and_return(true)
......
...@@ -11,7 +11,6 @@ module StubExperiments ...@@ -11,7 +11,6 @@ module StubExperiments
allow(Gitlab::Experimentation).to receive(:active?).and_call_original allow(Gitlab::Experimentation).to receive(:active?).and_call_original
experiments.each do |experiment_key, enabled| experiments.each do |experiment_key, enabled|
Feature.persist_used!("#{experiment_key}#{feature_flag_suffix}")
allow(Gitlab::Experimentation).to receive(:active?).with(experiment_key) { enabled } allow(Gitlab::Experimentation).to receive(:active?).with(experiment_key) { enabled }
end end
end end
...@@ -26,14 +25,7 @@ module StubExperiments ...@@ -26,14 +25,7 @@ module StubExperiments
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).and_call_original allow(Gitlab::Experimentation).to receive(:in_experiment_group?).and_call_original
experiments.each do |experiment_key, enabled| experiments.each do |experiment_key, enabled|
Feature.persist_used!("#{experiment_key}#{feature_flag_suffix}")
allow(Gitlab::Experimentation).to receive(:in_experiment_group?).with(experiment_key, anything) { enabled } allow(Gitlab::Experimentation).to receive(:in_experiment_group?).with(experiment_key, anything) { enabled }
end end
end end
private
def feature_flag_suffix
Gitlab::Experimentation::Experiment::FEATURE_FLAG_SUFFIX
end
end end
...@@ -66,8 +66,4 @@ module StubFeatureFlags ...@@ -66,8 +66,4 @@ module StubFeatureFlags
def skip_feature_flags_yaml_validation def skip_feature_flags_yaml_validation
allow(Feature::Definition).to receive(:valid_usage!) allow(Feature::Definition).to receive(:valid_usage!)
end end
def skip_default_enabled_yaml_check
allow(Feature::Definition).to receive(:default_enabled?).and_return(false)
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment