Skip to content

Move build log's ANSI Reset to before newline to fix test output 

What does this MR do?

Moves ANSI Reset to before \n on build log lines.

Why was this MR needed?

Whilst this will effect all log lines that come from the build logger (which does not include user script execution), it's mainly done to help make our internal tests parsable.

#28000 (closed) details on why the existing order does not work.

What's the best way to test this MR?

  • Ensure that TestArtifactDownloadRunFailure log output is written correctly.

    Before MR:

    \033[0;m\033[31;1mERROR: Job failed (system failure): build fail
    \033[0;m--- PASS: TestArtifactDownloadRunFailure (0.00s)

    After MR:

    \033[31;1mERROR: Job failed (system failure): build fail\033[0;m
    --- PASS: TestArtifactDownloadRunFailure (0.00s)
  • Ensure that all log entries are rendered correctly by GitLab. Coloured output should be unaffected.

By looking at the TestArtifactDownloadRunFailure from this pipeline: https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/1360574568#L2068 and from 14.0: https://gitlab.com/gitlab-org/gitlab-runner/-/jobs/1360750410#L2078 we can see that the colour rendering is identical. If you look at the raw logs, you'll see --- PASS is now on its own line.

What are the relevant issue numbers?

Closes #28000 (closed)

Edited by Arran Walker

Merge request reports