When the orb sends workflow json (see example below) for a successful run, it never includes stopped_at
. Which makes sense because from the Insights API standpoint, the workflow hasn't finished yet.
{
"pipeline_id": "1c055742-7ead-44e1-9407-958cc2ba8bcf",
"id": "79ad735b-fa0e-4539-8db5-89b09adb425f",
"name": "stage-deploy",
"project_slug": "gh/xyz/xyz",
"status": "running",
"started_by": "d87d420e-cb2c-4b42-ace7-db839d0ec256",
"pipeline_number": 17132,
"created_at": "2021-09-24T21:31:33Z",
"stopped_at": null
}
Expected behavior
While existing behavior makes sense from Insights API standpoint, it makes it impossible to calculate workflow duration. Which is a very valuable piece of info since that generally is what your build duration is. Measuring individuals jobs is useful, but it doesn't tell you how long the overall build takes.
Suggested solution
We can assume that the workflow is done when the orb sends the data (by definition, that's the logic within). We can either append another field to json or override the value in stopped_at
with current system time.
P.S. I am open to making a contribution assuming we agree on the direction for the fix.