Repository navigation
fix(ansible): keep the ros-apt-source lookup off the anonymous GitHub rate limit - #7391
hakuturu583 wants to merge 2 commits into
Conversation
…imit The ros2 role resolves the latest ros-apt-source release through api.github.com with no credentials. Anonymous requests get 60 an hour per source address and CI runners share theirs, so the call fails the whole play with "API rate limit exceeded" whenever the pool is busy -- intermittently today, on PRs that change nothing near ansible/. Send a token when one is available. ros2_github_token defaults to $GITHUB_TOKEN, which the two workflows that run the playbook now pass in; a workflow token is allowed 1000 requests an hour for the repository. With no token the request is anonymous exactly as before, so a developer's machine and the Docker builds are unaffected, and setting the variable empty forces that back for an environment whose GITHUB_TOKEN is expired. Also retry the call three times. That covers a transient network error or a 5xx, not a spent rate limit, which only resets on the hour. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Masaya Kataoka <cld-masaya.kataoka@tier4.jp>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46950fa6fc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| download_url: https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ansible-posix-2.2.2.tar.gz | ||
| format_version: 1.0.0 | ||
| name: posix | ||
| namespace: ansible |
There was a problem hiding this comment.
Remove the generated Ansible Galaxy cache from the commit
This adds an installed ansible.posix cache containing 218 files and 26,467 lines, including upstream tests, CI configuration, and installation metadata. ansible/galaxy.yml already declares this dependency, and neither modified workflow is configured to use the checked-in cache, so this creates a second dependency source tree that can drift from the version actually installed while unnecessarily expanding every checkout. Remove the generated .ansible/ tree and ignore that directory to prevent subsequent tooling runs from reintroducing it.
Useful? React with 👍 / 👎.
Description
The
ros2role resolves the latestros-apt-sourcerelease throughapi.github.comwith no credentials (ansible/roles/ros2/tasks/main.yaml). Anonymous requests are allowed 60 an hour per source address, and GitHub-hosted runners share their egress addresses, so when that pool is busy the call fails and takes the whole play with it:It is intermittent, which makes it worse than a hard break: the same branch fails and passes on consecutive pushes, on PRs that change nothing near
ansible/. On #7390, four pushes of nearly the same tree gave two failures and two passes, and each failure cost a full re-run.ros2_github_token, defaults to$GITHUB_TOKENand is sent as anAuthorization: Bearerheader when non-empty. A workflow'sGITHUB_TOKENis allowed 1000 requests an hour for the repository, a PAT 5000.health-check-ansibleandregenerate-lockfiles. (health-check-ansible-artifactsruns--tags artifacts, so theros2role never runs there.)-e ros2_github_token=forces that back for an environment whoseGITHUB_TOKENis expired — which would otherwise fail with 401 rather than fall back. That trade is why the token is a documented role input rather than an implicit environment read.The task is deliberately not
no_log, so that a 401 or 403 stays readable.-v, which both workflows use, does not print module arguments;-vvvdoes.How was this PR tested?
On Ubuntu 22.04.5 with ansible-core 2.17.14, running the real role against the real endpoint.
The limit the request actually gets, read back from the response header:
GITHUB_TOKENx-ratelimit-limit-e ros2_github_token=with a token in the environmentSo the 60-an-hour pool that CI keeps exhausting is exactly what the unauthenticated path still gets, and a token moves off it.
The role end to end (
import_roleonautoware.dev_env.ros2,use_locked_versions=false), in all three conditions — token unset, token set, token overridden empty: the release lookup, "Extract latest version" (1.3.0), the codename shell task andget_urlofros2-apt-source_1.3.0.jammy_all.deball succeeded, leaving a 4.4 KB.debat/tmp/ros2-apt-source.deb. Only the finalapttask failed, onsudo: a password is requiredon the test host, which is below this change.A stale token is a hard failure, by design: with
GITHUB_TOKEN=ghp_invalid...the task retries three times and fails with401 Bad credentials, rather than silently falling back to the anonymous limit. Documented in the role defaults, with the-e ros2_github_token=escape hatch.Token leakage: ran the task with a sentinel token at both verbosity levels and grepped the output —
-v0 hits,-vvv4 hits. Both workflows use-v, and Actions maskssecrets.GITHUB_TOKENbesides.ansible-lint ansible/passes (0 failures, 89 files, profileproduction), andprettierwas run on the README.Not covered
regenerate-lockfilesisworkflow_dispatch-only, so its env change is untested here beyond being the same two lines as the other workflow.🤖 Generated with Claude Code