Skip to content

fix(ci): add pagination to check-cuda-versions GitLab API calls - #5

Closed
smoparth wants to merge 1 commit into
mainfrom
ambient/session-af538a91-b15e-4bcf-8650-4950719acba6
Closed

fix(ci): add pagination to check-cuda-versions GitLab API calls#5
smoparth wants to merge 1 commit into
mainfrom
ambient/session-af538a91-b15e-4bcf-8650-4950719acba6

Conversation

@smoparth

Copy link
Copy Markdown
Owner

Summary

  • Add pagination support to the check-cuda-versions workflow's GitLab API calls
  • Extract API fetching into a fetch_all_pages() function that loops through pages until exhausted
  • Include safety limit (10 pages / 1000 items) with ::warning:: annotation if reached

Details

The workflow previously made a single curl call with per_page=100. While NVIDIA currently has only ~19 entries in their dist/ directory, this would silently truncate results if the count exceeded 100.

The new fetch_all_pages() function:

  • Loops through pages incrementing page parameter
  • Merges JSON arrays across pages using jq -s 'add'
  • Exits on empty response, zero-length array, or fewer than per_page items
  • Has a safety limit of 10 pages to prevent infinite loops
  • Emits a GitHub Actions warning if the safety limit is reached

Both the primary (URL-encoded path) and fallback (numeric ID) API calls use the same function.

Test plan

  • Tested fetch_all_pages() against live NVIDIA GitLab API — returns all 19 items
  • Verified JSON output format is backward compatible with downstream processing
  • Tested edge case: invalid project ID returns [], enabling fallback
  • Validated YAML syntax

Fixes opendatahub-io#28

🤖 Generated with Claude Code

The check-cuda-versions workflow fetched CUDA versions from NVIDIA's
GitLab API with per_page=100 but made only a single API call with no
pagination handling. If NVIDIA's dist/ directory exceeds 100 entries,
results would be silently truncated.

Add a fetch_all_pages() function that loops through pages, accumulates
JSON arrays with jq, and includes a safety limit of 10 pages (1000
items max) to prevent infinite loops.

Fixes opendatahub-io#28

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@smoparth smoparth closed this Mar 27, 2026
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.

Add pagination support to check-cuda-versions workflow

1 participant