debian-mirror-gitlab/app/models/ci/build_trace.rb

24 lines
501 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
module Ci
class BuildTrace
attr_reader :trace, :build
delegate :state, :append, :truncated, :offset, :size, :total, to: :trace, allow_nil: true
delegate :id, :status, :complete?, to: :build, prefix: true
2020-07-28 23:09:34 +05:30
def initialize(build:, stream:, state:)
2019-12-21 20:55:43 +05:30
@build = build
if stream.valid?
stream.limit
2020-07-28 23:09:34 +05:30
@trace = Gitlab::Ci::Ansi2json.convert(stream.stream, state)
2019-12-21 20:55:43 +05:30
end
end
2020-07-28 23:09:34 +05:30
def lines
@trace&.lines
2019-12-21 20:55:43 +05:30
end
end
end