Skip to content

Add timestamps to all job output

What does this MR do?

Adds a timestamp to all output lines from the job.
This is not as robust as the things discussed at #2412 (moved) or gitlab-org/gitlab-ce#22745.
But it is simple and achieves the basic result - just displaying the timestamp.

@brendan I'm marking this as closes 22745 because I'd like to make this an MVC for that, and open new issues for any additional scope.

Closes gitlab-org/gitlab-ce#22745

Ways to improve

  1. We can add A CI_TIMESTAMP_FORMAT variable and use it instead of time.StampMilli + "\t" to let users change the format.
    It will also mean that they can disable the feature by setting it an empty string (we can even default to it for compat).

  2. We can prefix the timestamp with timestamp: and hide it in ansi2html on the frontend like with section_start:

I can work on any of those, if it mean that this MR can eventually be merged.

Why was this MR needed?

See discussion on the relevant issues.

Are there points in the code the reviewer needs to double check?

The change to build_logger.go is made so we don't have a dangling timestamp because of the invisible ANSI_RESET at the end.

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

#2412 (moved) and gitlab-org/gitlab-ce#22745

Edited by Daniel Shaulov

Merge request reports