Make full log viewer section parsing more strict
What does this MR do and why?
Background
Our runner logs contain log sections that can be collapsed and uncollapsed, these are delimited by that fulfill the following pattern: section_start:[0-9]+:[a-z_]+.
Issue
Users may output lines that are similar to our section delimiters in the log.
This change makes the parsing of these delimiters more strict so it becomes less likely that a log is parsed incorrectly.
Changelog: fixed
Fixes issue identified at #454817 (comment 2020633856).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
It's possible to reproduce the issue using the following build log: https://gitlab.com/octopus-code/octopus/-/jobs/6976562278/viewer
| Before | After |
|---|---|
|
|
How to set up and validate locally
You can download the raw log at https://gitlab.com/octopus-code/octopus/-/jobs/6976562278/viewer locally and view it in the viewer on your GDK.
- Go to you GDK directory
cd <you gdk directory> - Download the example job log to verify
curl -L https://gitlab.com/octopus-code/octopus/-/jobs/6976562278/raw > public/assets/broken-sections-log.txt - Apply the following diff, to load the example job log:
diff --git a/app/assets/javascripts/ci/job_log_viewer/lib/generate_stream.js b/app/assets/javascripts/ci/job_log_viewer/lib/generate_stream.js
index d39ec95b9961..34a14b145978 100644
--- a/app/assets/javascripts/ci/job_log_viewer/lib/generate_stream.js
+++ b/app/assets/javascripts/ci/job_log_viewer/lib/generate_stream.js
@@ -7,7 +7,7 @@ import Scanner from './scanner';
* https://issues.chromium.org/issues/40612900
*/
async function* getIterableFileStream(path) {
- const response = await fetch(path);
+ const response = await fetch('/assets/broken-sections-log.txt');
const reader = response.body.getReader();
while (true) {
- Visit a full job viewer page, any job will do: http://gdk.test:3000/my-group/my-project/-/jobs/2504/viewer
Related to #454817

