summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/features.rb
blob: b9a1eba2b4a1d2ba6de971bb754899b5c496f698 (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
33
34
35
36
37
38
# frozen_string_literal: true

module Gitlab
  module Ci
    ##
    # Ci::Features is a class that aggregates all CI/CD feature flags in one place.
    #
    module Features
      # NOTE: The feature flag `disallow_to_create_merge_request_pipelines_in_target_project`
      # is a safe switch to disable the feature for a particular project when something went wrong,
      # therefore it's not supposed to be enabled by default.
      def self.disallow_to_create_merge_request_pipelines_in_target_project?(target_project)
        ::Feature.enabled?(:ci_disallow_to_create_merge_request_pipelines_in_target_project, target_project)
      end

      def self.accept_trace?(project)
        ::Feature.enabled?(:ci_enable_live_trace, project) &&
          ::Feature.enabled?(:ci_accept_trace, project, type: :ops, default_enabled: true)
      end

      def self.log_invalid_trace_chunks?(project)
        ::Feature.enabled?(:ci_trace_log_invalid_chunks, project, type: :ops, default_enabled: false)
      end

      def self.display_quality_on_mr_diff?(project)
        ::Feature.enabled?(:codequality_mr_diff, project, default_enabled: :yaml)
      end

      def self.gldropdown_tags_enabled?
        ::Feature.enabled?(:gldropdown_tags, default_enabled: :yaml)
      end

      def self.require_builds_token_encryption?
        Feature.enabled?(:ci_builds_tokens_required_encryption, default_enabled: :yaml)
      end
    end
  end
end