Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use keyset pagination only when it is supported #755

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Dec 1, 2023

#744 switched to keyset pagination for the /api/v4/projects/:id/jobs API endpoint, but this feature is only available in GitLab 15.9 and later (https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs).

This commit retrieves the instance metadata at startup to determine whether keyset pagination is available. If the metadata is not available or returns a version < 15.9, offset pagination will be used.

@stanhu stanhu force-pushed the sh-conditional-keyset-pagination branch from b1f6d23 to daba1a1 Compare December 1, 2023 06:04
@coveralls
Copy link

coveralls commented Dec 1, 2023

Coverage Status

coverage: 75.387% (+0.2%) from 75.161%
when pulling 73dd2d3 on stanhu:sh-conditional-keyset-pagination
into c4d9649 on mvisonneau:main.

@stanhu stanhu force-pushed the sh-conditional-keyset-pagination branch from daba1a1 to 8e62767 Compare December 1, 2023 06:08
@stanhu stanhu force-pushed the sh-conditional-keyset-pagination branch 2 times, most recently from 430154c to 6c0ace3 Compare December 1, 2023 06:54
mvisonneau#744
switched to keyset pagination for the `/api/v4/projects/:id/jobs` API
endpoint, but this feature is only available in GitLab 15.9 and later
(https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs).

This commit retrieves the instance metadata at startup to
determine whether keyset pagination is available. If the metadata
is not available or returns a version < 15.9, offset pagination will
be used.
@stanhu stanhu force-pushed the sh-conditional-keyset-pagination branch from 6c0ace3 to 45dc3ed Compare December 1, 2023 07:13
@stanhu
Copy link
Contributor Author

stanhu commented Dec 4, 2023

@mvisonneau Could you take a look?

Copy link
Owner

@mvisonneau mvisonneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a ton! @stanhu

pkg/controller/metadata.go Outdated Show resolved Hide resolved
pkg/gitlab/version.go Show resolved Hide resolved
@stanhu stanhu force-pushed the sh-conditional-keyset-pagination branch from b6844da to 73dd2d3 Compare December 4, 2023 21:39
@mvisonneau mvisonneau merged commit 0687efd into mvisonneau:main Dec 5, 2023
5 checks passed
@stanhu
Copy link
Contributor Author

stanhu commented Dec 5, 2023

@mvisonneau Thanks! Could I trouble you for a release?

@stanhu
Copy link
Contributor Author

stanhu commented Dec 6, 2023

Thank you for v0.5.6!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants