Improve `grep` snippet for MR template `New Version of gitlab-styles`

What does this MR do and why?

While working on !179410 (merged), I noticed the grep --perl-regex ... provided on the MR template doesn't work as expected.

The 1st commit 0b28ee32 fixes the regex, and 2nd commit c7ba5fad proposes switching to --extended-regexp to make it work for BSD grep (macOS users) in addition to GNU grep.

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

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

For 0b28ee32

Before After
image image

For c7ba5fad

OS Before After
Ubuntu image image
macOS image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Get example input like wget https://gitlab.com/-/project/278964/uploads/8c8bbab787b494279f21960d7b6e36bd/raw_job_output.log (from !179410 (merged))
  2. Run grep --perl-regexp -o ":\d+\d+: \w: \[\S+\] ([\w/]+)" raw_job_output.log | awk '{print $4}' | sort | uniq -c to see incorrect output
  3. Run grep --perl-regexp -o ":\d+:\d+: \w: \[\S+\] ([\w/]+)" raw_job_output.log | awk '{print $4}' | sort | uniq -c to see correct output
  4. Run grep --extended-regexp -o ":[0-9]+:[0-9]+: [[:alnum:]]: \[[^[:space:]]+\] ([[:alnum:]/]+)" raw_job_output.log | awk '{print $4}' | sort | uniq -c to see the correct output. This works for BSD grep in addition to GNU grep.
Edited by Chou Yu Ta

Merge request reports

Loading