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
|
2023-06-20 00:43:36 +05:30
|
|
|
@trace = Gitlab::Ci::Ansi2json.convert(
|
|
|
|
stream.stream,
|
|
|
|
state,
|
|
|
|
verify_state: Feature.enabled?(:sign_and_verify_ansi2json_state, build.project)
|
|
|
|
)
|
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
|