Skip to content

Look up the ros-apt-source version without the GitHub API - #895

Merged
christophebedard merged 2 commits into
ros-tooling:mainfrom
HappySamuel:fix/ros-apt-source-version-lookup
Nov 19, 2026
Merged

christophebedard merged 2 commits into
ros-tooling:mainfrom
HappySamuel:fix/ros-apt-source-version-lookup

Conversation

@HappySamuel

@HappySamuel HappySamuel commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #892.

The latest ros-apt-source version came from the GitHub REST API without a token:

export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F'"' '{print $4}')

Unauthenticated API requests are limited to 60 per hour per IP address, and GitHub-hosted runners share IP addresses, so the request often fails with a rate-limit error. curl -s does not fail on that, and the empty substitution inside export does not stop the script, so the version ends up empty and the download returns a 404 (.../releases/download//ros2-apt-source_.noble_all.deb).

This change gets the version from the redirect of https://github.com/ros-infrastructure/ros-apt-source/releases/latest (to .../releases/tag/<version>), which does not go through the REST API rate limit. Both curl calls use --fail and retries, and the script runs with set -eo pipefail, so a failed lookup stops the step instead of continuing to a 404.

Tested:

  • npm run lint, and npm run build with dist/ checked in.
  • The generated script installs ros2-apt-source and ros2-testing-apt-source 1.3.0 in clean ubuntu:jammy and ubuntu:noble containers, and apt-cache policy then lists packages.ros.org.

Generated-by: Claude Code (Claude Opus 5.5) was used to find the cause, write the fix, and draft this description. I reviewed the change and the results.

🤖 Generated with Claude Code

The latest ros-apt-source version came from the GitHub REST API without a
token. That is limited to 60 requests per hour per IP address, and runners
share IP addresses, so the request often failed. The version was then empty
and the download returned a 404 (ros-tooling#892).

Get the version from the redirect of the release page instead, retry, and
stop with a clear error if no version is found.

Signed-off-by: HappySamuel <[email protected]>
Comment thread src/setup-ros-ubuntu.ts Resolved
Comment thread __test__/ros-apt-source.test.ts Resolved
@HappySamuel

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I removed the version check and the test, so the change is now only the version lookup in src/setup-ros-ubuntu.ts (plus dist/). I also updated the description.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: HappySamuel <[email protected]>
@HappySamuel
HappySamuel force-pushed the fix/ros-apt-source-version-lookup branch from 8587bb8 to 22bd1c2 Compare November 19, 2026 02:15
@christophebedard

Copy link
Copy Markdown
Member

Closing and re-opening to trigger CI

@christophebedard christophebedard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the PR

@christophebedard
christophebedard merged commit 997c928 into ros-tooling:main Nov 19, 2026
28 of 30 checks passed
@HappySamuel
HappySamuel deleted the fix/ros-apt-source-version-lookup branch November 20, 2026 01:26
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.

frequent 404 when downloading ros-apt-source

2 participants