2018-11-13 16:29:14 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
module PipelineEnums
|
|
|
|
# Returns the `Hash` to use for creating the `failure_reason` enum for
|
|
|
|
# `Ci::Pipeline`.
|
|
|
|
def self.failure_reasons
|
|
|
|
{
|
|
|
|
unknown_failure: 0,
|
2019-12-14 09:07:51 +00:00
|
|
|
config_error: 1,
|
|
|
|
external_validation_failure: 2
|
2018-11-13 16:29:14 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
# Returns the `Hash` to use for creating the `sources` enum for
|
|
|
|
# `Ci::Pipeline`.
|
|
|
|
def self.sources
|
|
|
|
{
|
|
|
|
unknown: nil,
|
|
|
|
push: 1,
|
|
|
|
web: 2,
|
|
|
|
trigger: 3,
|
|
|
|
schedule: 4,
|
|
|
|
api: 5,
|
2018-12-05 06:57:00 +00:00
|
|
|
external: 6,
|
2020-01-13 12:08:04 +00:00
|
|
|
# TODO: Rename `pipeline` to `cross_project_pipeline` in 13.0
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/issues/195991
|
2020-01-08 12:07:59 +00:00
|
|
|
pipeline: 7,
|
2019-02-20 21:29:48 +00:00
|
|
|
chat: 8,
|
2020-05-25 15:07:58 +00:00
|
|
|
webide: 9,
|
2019-08-09 09:40:45 +00:00
|
|
|
merge_request_event: 10,
|
2020-01-13 12:08:04 +00:00
|
|
|
external_pull_request_event: 11,
|
2020-06-16 12:09:00 +00:00
|
|
|
parent_pipeline: 12,
|
2020-07-02 15:09:08 +00:00
|
|
|
ondemand_dast_scan: 13
|
2018-11-13 16:29:14 +00:00
|
|
|
}
|
|
|
|
end
|
2018-12-13 14:12:36 +00:00
|
|
|
|
|
|
|
# Returns the `Hash` to use for creating the `config_sources` enum for
|
|
|
|
# `Ci::Pipeline`.
|
|
|
|
def self.config_sources
|
|
|
|
{
|
|
|
|
unknown_source: nil,
|
|
|
|
repository_source: 1,
|
2019-12-05 18:07:51 +00:00
|
|
|
auto_devops_source: 2,
|
2020-05-25 15:07:58 +00:00
|
|
|
webide_source: 3,
|
2019-12-05 18:07:51 +00:00
|
|
|
remote_source: 4,
|
2020-01-13 12:08:04 +00:00
|
|
|
external_project_source: 5,
|
2020-06-25 15:08:37 +00:00
|
|
|
bridge_source: 6,
|
|
|
|
parameter_source: 7
|
2018-12-13 14:12:36 +00:00
|
|
|
}
|
|
|
|
end
|
2019-12-05 18:07:51 +00:00
|
|
|
|
2020-02-13 18:09:00 +00:00
|
|
|
def self.ci_config_sources
|
|
|
|
config_sources.slice(
|
2019-12-05 18:07:51 +00:00
|
|
|
:unknown_source,
|
|
|
|
:repository_source,
|
|
|
|
:auto_devops_source,
|
|
|
|
:remote_source,
|
2020-02-13 18:09:00 +00:00
|
|
|
:external_project_source
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.ci_config_sources_values
|
|
|
|
ci_config_sources.values
|
2019-12-05 18:07:51 +00:00
|
|
|
end
|
2020-07-17 18:09:20 +00:00
|
|
|
|
|
|
|
def self.non_ci_config_source_values
|
|
|
|
config_sources.values - ci_config_sources.values
|
|
|
|
end
|
2018-11-13 16:29:14 +00:00
|
|
|
end
|
|
|
|
end
|
2019-09-13 13:26:31 +00:00
|
|
|
|
|
|
|
Ci::PipelineEnums.prepend_if_ee('EE::Ci::PipelineEnums')
|