GraphQL: `Pipeline.jobs(statuses: FAILED)` returns misleading results
The following query returns misleading results:
query($id: MergeRequestID!) {
mergeRequest(id: $id) {
headPipeline {
status
finishedAt startedAt createdAt duration
jobs(statuses: [FAILED]) {
nodes { name stage { name } allowFailure }
}
}
}
}
If a job has failed, and was restarted, the old failed instance turns up in the result list, which is basically fair enough, since it did fail.
But it is not the most recent version of that job - it is not fresh.
We should allow users to indicate if they only want to see information about fresh jobs, i.e. the most recent version of each job.
Suggestion
Add a new argument to Pipeline.jobs
: fresh: Boolean = false
.
This would remove stale jobs from the result list.
This could be implemented by adding a new boolean column to jobs (fresh
?, stale
?, restarted
?)
that is set whenever a job is restarted, and using that to filter on.
Alternatively, RESTARTED
could be its own status in the state-machine, but
this is less nice since we might want to see the original status.