Module: Ci::HasStatus

Extended by:
ActiveSupport::Concern
Included in:
Pipeline, Stage, CommitStatus
Defined in:
app/models/concerns/ci/has_status.rb

Constant Summary collapse

DEFAULT_STATUS =
'created'
BLOCKED_STATUS =
%w[manual scheduled].freeze
AVAILABLE_STATUSES =
%w[created waiting_for_resource preparing pending running success failed canceled skipped manual scheduled].freeze
STARTED_STATUSES =
%w[running success failed].freeze
ACTIVE_STATUSES =
%w[waiting_for_resource preparing pending running].freeze
COMPLETED_STATUSES =
%w[success failed canceled skipped].freeze
STOPPED_STATUSES =
COMPLETED_STATUSES + BLOCKED_STATUS
ORDERED_STATUSES =
%w[failed preparing pending running waiting_for_resource manual scheduled canceled success skipped created].freeze
PASSED_WITH_WARNINGS_STATUSES =
%w[failed canceled].to_set.freeze
EXCLUDE_IGNORED_STATUSES =
%w[manual failed canceled].to_set.freeze
ALIVE_STATUSES =
(ACTIVE_STATUSES + ['created']).freeze
CANCELABLE_STATUSES =
(ALIVE_STATUSES + ['scheduled']).freeze
STATUSES_ENUM =
{ created: 0, pending: 1, running: 2, success: 3,
failed: 4, canceled: 5, skipped: 6, manual: 7,
scheduled: 8, preparing: 9, waiting_for_resource: 10 }.freeze
UnknownStatusError =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)

107
108
109
# File 'app/models/concerns/ci/has_status.rb', line 107

def active?
  ACTIVE_STATUSES.include?(status)
end

#blocked?Boolean

Returns:

  • (Boolean)

115
116
117
# File 'app/models/concerns/ci/has_status.rb', line 115

def blocked?
  BLOCKED_STATUS.include?(status)
end

#complete?Boolean

Returns:

  • (Boolean)

111
112
113
# File 'app/models/concerns/ci/has_status.rb', line 111

def complete?
  COMPLETED_STATUSES.include?(status)
end

#started?Boolean

Returns:

  • (Boolean)

103
104
105
# File 'app/models/concerns/ci/has_status.rb', line 103

def started?
  STARTED_STATUSES.include?(status) && !!started_at
end