Skip to content

Improve end_time calculation for running pipelines

What does this MR do and why?

Describe in detail what your merge request does and why.

  • Do not use finished_at timestamp of pipelines in manual state.

    When a pipeline is in manual state, the API does not return a correct finished_at timestamp.

  • Rename the Pipeline#completed? method to valid_finished_at? since that is a more accurate name for what the method is being used for.

  • Use the finished_at timestamp of the last completed job as pipeline end_time.

    When a pipeline is not in the success, failed or canceled states, we cannot rely on the finished_at returned by the pipeline API. In those cases, the end_time of the pipeline can be considered to be the finished_at timestamp of the last job to complete.

    This is a better way to get the end_time of a pipeline that is still running. Currently we just consider Time.current as the end_time, which gives very wrong values if the trace job is run much after the rest of the pipeline completed.

gitlab-com/gl-infra/delivery#2915 (closed)

Author Check-list

  • Has documentation been updated?
Edited by Reuben Pereira

Merge request reports