diff options
Diffstat (limited to 'app/services/ci/append_build_trace_service.rb')
-rw-r--r-- | app/services/ci/append_build_trace_service.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/ci/append_build_trace_service.rb b/app/services/ci/append_build_trace_service.rb index 0eef0ff0e61..a5ef5b27100 100644 --- a/app/services/ci/append_build_trace_service.rb +++ b/app/services/ci/append_build_trace_service.rb @@ -20,6 +20,9 @@ module Ci # as we cannot use `content_length[1]` # Issue: https://gitlab.com/gitlab-org/gitlab-runner/issues/3275 + # Update the build metadata prior to appending trace content + update_build_metadata if debug_trace + content_range = stream_range.split('-') body_start = content_range[0].to_i body_end = body_start + body_data.bytesize @@ -49,6 +52,18 @@ module Ci params.fetch(:content_range) end + def debug_trace + params.fetch(:debug_trace, false) + end + + # rubocop: disable CodeReuse/ActiveRecord + def update_build_metadata + metadata = Ci::BuildMetadata.find_by(build_id: build) + + metadata.update!(debug_trace_enabled: debug_trace) + end + # rubocop: enable CodeReuse/ActiveRecord + def log_range_error(stream_size, body_end) extra = { build_id: build.id, |