summaryrefslogtreecommitdiff
path: root/app/models/ci/build_pending_state.rb
blob: 299c67f441dd03b97cee5a13d283c16bf4a7f525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class Ci::BuildPendingState < ApplicationRecord
  extend Gitlab::Ci::Model

  belongs_to :build, class_name: 'Ci::Build', foreign_key: :build_id

  enum state: Ci::Stage.statuses
  enum failure_reason: CommitStatus.failure_reasons

  validates :build, presence: true

  def crc32
    trace_checksum.try do |checksum|
      checksum.to_s.split('crc32:').last.to_i(16)
    end
  end
end