Limit size read from jobs log to 16KB in htmlSummary.
What does this MR do and why?
Fixes #423449 (closed)
This MR adds a read_last_lines_with_max_size
function to Stream. This function allows anyone to limit the size read from the stream.
This MR then use this function to limit retrieved size for failing jobs to 16KB.
It subsequently uses this parameter in the view
Screenshots or screen recordings
(This won't really change the UI)
How to set up and validate locally
(I did not test the changes from the UI)
- Create a failing job trace with long lines as described in #423449 (closed)
- Navigate to the failing jobs pipeline UI
- Notice the job log is truncated (with less than 10 lines)
I added automated tests that are passing.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Run tests associated:
bin/rspec spec/graphql/types/ci/job_trace_type_spec.rb -e max_size
bin/rspec spec/lib/gitlab/ci/trace/stream_spec.rb -e "max size"
Questions answered
-
Use 16 KB as default value ? Yes (!130984 (comment 1553294656)) -
Cleanup leading space when truncated ? No (!130984 (comment 1550531985)) -
Handle truncated UTF-8 codepoint ? No (!130984 (comment 1550609340)) -
Allow the user to customize the size ? No (!130984 (comment 1555712990)) -
Put this change under a feature flag ? Yes (!130984 (comment 1559596846)) -
Force ASCII-8BIT
? (!130984 (comment 1553968034))
Edited by homer