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
IGNORED_STATUSES =
%w[manual].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)


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

def active?
  ACTIVE_STATUSES.include?(status)
end

#blocked?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'app/models/concerns/ci/has_status.rb', line 118

def blocked?
  BLOCKED_STATUS.include?(status)
end

#complete?Boolean

Returns:

  • (Boolean)


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

def complete?
  COMPLETED_STATUSES.include?(status)
end

#incomplete?Boolean

Returns:

  • (Boolean)


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

def incomplete?
  COMPLETED_STATUSES.exclude?(status)
end

#started?Boolean

Returns:

  • (Boolean)


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

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