Skip to content

Runners jobs API - sort desc does not work

Summary

Trying to sort runner jobs by descending ID does not work. Jobs are always returned in ascending ID order.

It would nice if you could order_by anything other by id too, for example branch.

Steps to reproduce

Gitlab 13.5.4 Premium Omnibus

  1. Call the Runner jobs API with sort=desc (GET /runners/:id/jobs?sort=desc)
  2. Results are ordered by ascending job ID

What is the current bug behavior?

Results are always ordered by ascending job ID

What is the expected correct behavior?

Results are ordered by descending job ID if sort=desc passed.

Relevant logs and/or screenshots

$ curl --silent -H 'PRIVATE-TOKEN: xx' -X GET -k 'https://gitlab.example.com/api/v4/runners/1337/jobs?sort=desc' | jq '.[].id'
671641
671674
671693
671699
671714
671724
671731
671744
671767
671768
671789
671803
671807
671809
671820
671852
671869
671889
671892
671897
Edited by Ben Prescott_