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 tovalid_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 pipelineend_time
.When a pipeline is not in the
success
,failed
orcanceled
states, we cannot rely on thefinished_at
returned by the pipeline API. In those cases, theend_time
of the pipeline can be considered to be thefinished_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 considerTime.current
as theend_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?