[go: up one dir, main page]

Commit API does not set total pages header

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

We're on Gitlab Premium self hosted 15.7.5ee (we update every other week).

We use the commits API in CI pipelines to dynamically determine the version number as the # of commits to the main branch. Some of our repos exceed 100 commits, which is the maximum page size. For those repos we found that the commits API was not properly setting the x-total-pages header, thus the standard pattern we use for paginating through results was not working. It looks like this was broken intentionally for performance reasons.

We have a temporary workaround of comparing the x-next-page and x-current-page headers, but we are concerned that this will be broken in the future as well as the potential strain this puts on our webservice pods for our Gitlab instance.

We don't need the actual commits, just the total number. The statistics that hang off the projects API won't work because they aren't always up to date - they can lag by as much as 15 minutes.

Can we either get a feature flag to re-enable appropriate pagination on the commits API or have a new always-up-to-date attribute called like total_commits added to the branches API?

Open to other workarounds as long as they are:

  • able to be called via the REST API
  • Always up to date

Lastly, I suggest that the docs and code for the commits API be updated to be clear that it doesn't support pagination rather than partially supporting it.

Edited by 🤖 GitLab Bot 🤖