Open gerrywastaken opened 5 years ago
Hey Gerry! startedAt
should be the property you need.
So the calc would be finishedAt - startedAt
for build duration. If you want build wait time (how long spent waiting for an agent) that'd be startedAt - runnableAt
.
Let me know if that works for you! If it doesn't, you can re-open this or shoot an email to support ☺️
@toolmantim
I think startedAt
and runnableAt
are only available on the Job Type, but I'm needing the values for the build (I believe):
query:
query {
build(uuid: "b87f86b4-5de8-4d5d-a073-4b3184c0b969") {
createdAt
scheduledAt
finishedAt,
canceledAt
}
}
result:
{
"data": {
"build": {
"createdAt": "2018-10-08T01:58:55Z",
"scheduledAt": "2018-10-08T01:58:55Z",
"finishedAt": "2018-10-08T02:40:32Z",
"canceledAt": null
}
}
}
ActionController::Base.helpers.distance_of_time_in_words(
DateTime.parse('2018-10-08T02:40:32Z'),
DateTime.parse('2018-10-08T01:58:55Z')
)
=> "42 minutes"
If it doesn't, you can re-open this [...]
Unfortunately, Github doesn't allow me to do that if a ticket is closed by somebody else.
Is there any way to get the duration for a build from the GraphQL API?
This number (or something close to it):
I can see
createdAt
,scheduledAt
,finishedAt
,canceledAt
, but but nothing for duration. Trying to calculate this using the above values also doesn't work as it doesn't take into account pauses during block steps, like the "Passed in" calculation does.