blob: 5bd4a3d0287be89bc72c521a4a75552eab342f07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# frozen_string_literal: true
class IosSpecificTemplatesExperiment < ApplicationExperiment
control
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
|