2020-05-24 23:13:21 +05:30
|
|
|
# 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
|
|
|
|
def self.artifacts_exclude_enabled?
|
2020-06-23 00:09:42 +05:30
|
|
|
::Feature.enabled?(:ci_artifacts_exclude, default_enabled: true)
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
def self.instance_variables_ui_enabled?
|
|
|
|
::Feature.enabled?(:ci_instance_variables_ui, default_enabled: true)
|
|
|
|
end
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
def self.pipeline_latest?
|
|
|
|
::Feature.enabled?(:ci_pipeline_latest, default_enabled: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.pipeline_status_omit_commit_sha_in_cache_key?(project)
|
2020-10-24 23:57:45 +05:30
|
|
|
Feature.enabled?(:ci_pipeline_status_omit_commit_sha_in_cache_key, project, default_enabled: true)
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
# Remove in https://gitlab.com/gitlab-org/gitlab/-/issues/224199
|
|
|
|
def self.store_pipeline_messages?(project)
|
|
|
|
::Feature.enabled?(:ci_store_pipeline_messages, project, default_enabled: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.raise_job_rules_without_workflow_rules_warning?
|
2020-10-24 23:57:45 +05:30
|
|
|
::Feature.enabled?(:ci_raise_job_rules_without_workflow_rules_warning, default_enabled: true)
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
# NOTE: The feature flag `disallow_to_create_merge_request_pipelines_in_target_project`
|
2021-01-29 00:20:46 +05:30
|
|
|
# is a safe switch to disable the feature for a particular project when something went wrong,
|
2020-11-24 15:15:51 +05:30
|
|
|
# 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)
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
def self.project_transactionless_destroy?(project)
|
|
|
|
Feature.enabled?(:project_transactionless_destroy, project, default_enabled: false)
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
def self.trace_overwrite?
|
|
|
|
::Feature.enabled?(:ci_trace_overwrite, type: :ops, default_enabled: false)
|
2020-10-24 23:57:45 +05:30
|
|
|
end
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
def self.accept_trace?(project)
|
|
|
|
::Feature.enabled?(:ci_enable_live_trace, project) &&
|
2021-01-03 14:25:43 +05:30
|
|
|
::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
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
def self.pipeline_open_merge_requests?(project)
|
2021-03-08 18:12:59 +05:30
|
|
|
::Feature.enabled?(:ci_pipeline_open_merge_requests, project, default_enabled: true)
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def self.ci_pipeline_editor_page_enabled?(project)
|
2021-03-08 18:12:59 +05:30
|
|
|
::Feature.enabled?(:ci_pipeline_editor_page, project, default_enabled: :yaml)
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
def self.allow_failure_with_exit_codes_enabled?
|
2021-03-08 18:12:59 +05:30
|
|
|
::Feature.enabled?(:ci_allow_failure_with_exit_codes, default_enabled: :yaml)
|
2021-02-22 17:27:13 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def self.rules_variables_enabled?(project)
|
2021-03-08 18:12:59 +05:30
|
|
|
::Feature.enabled?(:ci_rules_variables, project, default_enabled: true)
|
2021-02-22 17:27:13 +05:30
|
|
|
end
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|