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 'app/experiments')
-rw-r--r--app/experiments/application_experiment.rb10
-rw-r--r--app/experiments/ios_specific_templates_experiment.rb30
-rw-r--r--app/experiments/logged_out_marketing_header_experiment.rb9
-rw-r--r--app/experiments/new_project_sast_enabled_experiment.rb15
-rw-r--r--app/experiments/video_tutorials_continuous_onboarding_experiment.rb6
5 files changed, 54 insertions, 16 deletions
diff --git a/app/experiments/application_experiment.rb b/app/experiments/application_experiment.rb
index f74e7fe3b1d..e5b67527cb1 100644
--- a/app/experiments/application_experiment.rb
+++ b/app/experiments/application_experiment.rb
@@ -3,6 +3,11 @@
class ApplicationExperiment < Gitlab::Experiment
control { nil } # provide a default control for anonymous experiments
+ # Documented in:
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/357904
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/345932
+ #
+ # @deprecated
def publish_to_database
ActiveSupport::Deprecation.warn('publish_to_database is deprecated and should not be used for reporting anymore')
@@ -21,10 +26,13 @@ class ApplicationExperiment < Gitlab::Experiment
# define a default nil control behavior so we can omit it when not needed
end
- # TODO: remove
# This is deprecated logic as of v0.6.0 and should eventually be removed, but
# needs to stay intact for actively running experiments. The new strategy
# utilizes Digest::SHA2, a secret seed, and generates a 64-byte string.
+ #
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/334590
+ #
+ # @deprecated
def key_for(source, seed = name)
source = source.keys + source.values if source.is_a?(Hash)
diff --git a/app/experiments/ios_specific_templates_experiment.rb b/app/experiments/ios_specific_templates_experiment.rb
new file mode 100644
index 00000000000..1731fa87be8
--- /dev/null
+++ b/app/experiments/ios_specific_templates_experiment.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class IosSpecificTemplatesExperiment < ApplicationExperiment
+ before_run(if: :skip_experiment) { throw(:abort) } # rubocop:disable Cop/BanCatchThrow
+
+ private
+
+ def skip_experiment
+ actor_not_able_to_create_pipelines? ||
+ project_targets_non_ios_platforms? ||
+ project_has_gitlab_ci? ||
+ project_has_pipelines?
+ end
+
+ def actor_not_able_to_create_pipelines?
+ !context.actor.is_a?(User) || !context.actor.can?(:create_pipeline, context.project)
+ end
+
+ def project_targets_non_ios_platforms?
+ context.project.project_setting.target_platforms.exclude?('ios')
+ end
+
+ def project_has_gitlab_ci?
+ context.project.has_ci? && context.project.builds_enabled?
+ end
+
+ def project_has_pipelines?
+ context.project.all_pipelines.count > 0
+ end
+end
diff --git a/app/experiments/logged_out_marketing_header_experiment.rb b/app/experiments/logged_out_marketing_header_experiment.rb
new file mode 100644
index 00000000000..3d88d94aec4
--- /dev/null
+++ b/app/experiments/logged_out_marketing_header_experiment.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class LoggedOutMarketingHeaderExperiment < ApplicationExperiment
+ # These default behaviors are overriden in ApplicationHelper and header
+ # template partial
+ control {}
+ candidate {}
+ variant(:trial_focused) {}
+end
diff --git a/app/experiments/new_project_sast_enabled_experiment.rb b/app/experiments/new_project_sast_enabled_experiment.rb
deleted file mode 100644
index 4aca4c875b2..00000000000
--- a/app/experiments/new_project_sast_enabled_experiment.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-class NewProjectSastEnabledExperiment < ApplicationExperiment
- control { }
- variant(:candidate) { }
- variant(:free_indicator) { }
- variant(:unchecked_candidate) { }
- variant(:unchecked_free_indicator) { }
-
- def publish(*args)
- super
-
- publish_to_database
- end
-end
diff --git a/app/experiments/video_tutorials_continuous_onboarding_experiment.rb b/app/experiments/video_tutorials_continuous_onboarding_experiment.rb
new file mode 100644
index 00000000000..3cb676b25f2
--- /dev/null
+++ b/app/experiments/video_tutorials_continuous_onboarding_experiment.rb
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+class VideoTutorialsContinuousOnboardingExperiment < ApplicationExperiment
+ control { }
+ candidate { }
+end