2019-02-15 15:39:39 +05:30
|
|
|
# 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,
|
2020-01-01 13:55:28 +05:30
|
|
|
config_error: 1,
|
|
|
|
external_validation_failure: 2
|
2019-02-15 15:39:39 +05:30
|
|
|
}
|
|
|
|
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,
|
|
|
|
external: 6,
|
2020-03-09 13:42:32 +05:30
|
|
|
# TODO: Rename `pipeline` to `cross_project_pipeline` in 13.0
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/issues/195991
|
2019-12-21 20:55:43 +05:30
|
|
|
pipeline: 7,
|
2019-07-07 11:18:12 +05:30
|
|
|
chat: 8,
|
2019-12-04 20:38:33 +05:30
|
|
|
merge_request_event: 10,
|
2020-03-09 13:42:32 +05:30
|
|
|
external_pull_request_event: 11,
|
|
|
|
parent_pipeline: 12
|
2019-02-15 15:39:39 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
# Returns the `Hash` to use for creating the `config_sources` enum for
|
|
|
|
# `Ci::Pipeline`.
|
|
|
|
def self.config_sources
|
|
|
|
{
|
|
|
|
unknown_source: nil,
|
|
|
|
repository_source: 1,
|
2020-01-01 13:55:28 +05:30
|
|
|
auto_devops_source: 2,
|
|
|
|
remote_source: 4,
|
2020-03-09 13:42:32 +05:30
|
|
|
external_project_source: 5,
|
|
|
|
bridge_source: 6
|
2019-02-15 15:39:39 +05:30
|
|
|
}
|
|
|
|
end
|
2020-01-01 13:55:28 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
def self.ci_config_sources
|
|
|
|
config_sources.slice(
|
2020-01-01 13:55:28 +05:30
|
|
|
:unknown_source,
|
|
|
|
:repository_source,
|
|
|
|
:auto_devops_source,
|
|
|
|
:remote_source,
|
2020-03-09 13:42:32 +05:30
|
|
|
:external_project_source
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.ci_config_sources_values
|
|
|
|
ci_config_sources.values
|
2020-01-01 13:55:28 +05:30
|
|
|
end
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
Ci::PipelineEnums.prepend_if_ee('EE::Ci::PipelineEnums')
|