Module: Enums::Ci::Pipeline

Defined in:
app/models/concerns/enums/ci/pipeline.rb

Class Method Summary collapse

Class Method Details

.ci_and_parent_sourcesObject



68
69
70
# File 'app/models/concerns/enums/ci/pipeline.rb', line 68

def self.ci_and_parent_sources
  ci_sources.merge(sources.slice(:parent_pipeline))
end

.ci_and_security_orchestration_sourcesObject



72
73
74
# File 'app/models/concerns/enums/ci/pipeline.rb', line 72

def self.ci_and_security_orchestration_sources
  ci_sources.merge(sources.slice(:security_orchestration_policy))
end

.ci_branch_sourcesObject



64
65
66
# File 'app/models/concerns/enums/ci/pipeline.rb', line 64

def self.ci_branch_sources
  ci_sources.except(:merge_request_event)
end

.ci_sourcesObject

CI sources are those pipeline events that affect the CI status of the ref they run for. By definition it excludes dangling pipelines.



60
61
62
# File 'app/models/concerns/enums/ci/pipeline.rb', line 60

def self.ci_sources
  sources.except(*dangling_sources.keys)
end

.config_sourcesObject

Returns the ‘Hash` to use for creating the `config_sources` enum for `Ci::Pipeline`.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'app/models/concerns/enums/ci/pipeline.rb', line 78

def self.config_sources
  {
    unknown_source: nil,
    repository_source: 1,
    auto_devops_source: 2,
    webide_source: 3,
    remote_source: 4,
    external_project_source: 5,
    bridge_source: 6,
    parameter_source: 7,
    compliance_source: 8,
    security_policies_default_source: 9
  }
end

.dangling_sourcesObject

Dangling sources are those events that generate pipelines for which we don’t want to directly affect the ref CI status.

  • when a webide pipeline fails it does not change the ref CI status to failed

  • when a child pipeline (from parent_pipeline source) fails it affects its parent pipeline. It’s up to the parent to affect the ref CI status

  • when an ondemand_dast_scan pipeline runs it is for testing purpose and should not affect the ref CI status.

  • when an ondemand_dast_validation pipeline runs it is for validating a DAST site profile and should not affect the ref CI status.



54
55
56
# File 'app/models/concerns/enums/ci/pipeline.rb', line 54

def self.dangling_sources
  sources.slice(:webide, :parent_pipeline, :ondemand_dast_scan, :ondemand_dast_validation, :security_orchestration_policy)
end

.failure_reasonsObject

Returns the ‘Hash` to use for creating the `failure_reason` enum for `Ci::Pipeline`.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/concerns/enums/ci/pipeline.rb', line 8

def self.failure_reasons
  {
    unknown_failure: 0,
    config_error: 1,
    external_validation_failure: 2,
    user_not_verified: 3,
    size_limit_exceeded: 21,
    job_activity_limit_exceeded: 22,
    deployments_limit_exceeded: 23,
    # 24 was previously used by the deprecated `user_blocked`
    project_deleted: 25
  }
end

.sourcesObject

Returns the ‘Hash` to use for creating the `sources` enum for `Ci::Pipeline`.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/models/concerns/enums/ci/pipeline.rb', line 24

def self.sources
  {
    unknown: nil,
    push: 1,
    web: 2,
    trigger: 3,
    schedule: 4,
    api: 5,
    external: 6,
    pipeline: 7,
    chat: 8,
    webide: 9,
    merge_request_event: 10,
    external_pull_request_event: 11,
    parent_pipeline: 12,
    ondemand_dast_scan: 13,
    ondemand_dast_validation: 14,
    security_orchestration_policy: 15
  }
end