| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I've verified it works as expected with https://github.com/riseproject-dev/riscv-runner-sample/actions/runs/24014042747/job/70030253499 |
Sorry, something went wrong.
|
@gdams 👋 would you know who would be a good person to have a loot at that? That would greatly unblock riscv64 on github more generally. Thank you very much! |
Sorry, something went wrong.
I'll ask around internally, just to clarify is your question Python specific or more generally about the state of riscv64 native runners? |
Sorry, something went wrong.
|
Merging that PR would enable a feature which would unblock users like using actions/setup-python on riscv64 runners, regardless where they are hosted. It would also enable other use cases like allowing Microsoft or any users of GitHub to point to their own builds of Python as well of course, which applies more broadly than just the support for riscv64. |
Sorry, something went wrong.
|
Hello! Following up on that. Also, please let me know if there is no chance this will get integrated, so that I can focus on workarounds. |
Sorry, something went wrong.
|
Hi @luhenry, Rebase first. It's conflicting, and install-python.ts on main now has fetchValidManifest() (retry + validation), RHEL filtering, and ESM imports. A couple of notes below only apply on the new base. 1. Scope mirror-token to the mirror's host, and don't prefix it. authForUrl() returns token ${mirrorToken} before host is checked, so a manifest entry pointing at objects.githubusercontent.com gets the private mirror credential. Hardcoding token is also wrong for internal mirrors, which want Bearer or Basic; setup-node passes its mirror token verbatim and lets the user own the scheme. For downloads, decide by host: mirror host with mirror-token set sends it verbatim, GitHub host sends token ${token}, anything else no auth. Leave getManifestFromRepo() alone. It only runs for GitHub repo mirrors, where mirror-token is the user's explicit intent and the API needs the prefix anyway, and the host rule would drop it there since api.github.com never matches the mirror host. Knock-on: the "takes precedence" lines in both input descriptions, the auth bullets in advanced-usage.md, and the case table in the PR description, plus a test for mirror-token being withheld from an incidental GitHub host. 2. Throw-as-control-flow costs 3 retries after rebase. getManifestFromRepo() throwing for non-GitHub mirrors lands inside fetchValidManifest(), and as a plain Error it won't short-circuit, so every custom-mirror run burns 3 attempts with backoff before falling back. Check resolveRepoCoords() in getManifest() and route straight to the URL fetch. Worth a test. 3. Docs and tests disagree on manifest auth. Docs say mirror-token covers "manifest fetch and tarball downloads," but getManifestFromURL() does a bare getJson() and the test asserts no auth header. Not a regression, but a private non-GitHub mirror will 401 on the manifest. Wire it through or fix the docs. 4. Slash branches silently lose auth. REPO_COORDS_RE uses ([^/]+) + $, so a fork on feature/riscv drops to an anonymous raw GET. Loosening the regex is ambiguous, so please warn on parse failure and document the limit instead. 5. getMirror() can throw from the error path. It re-validates on every call, including from find-python.ts when building the "version not found" message, so a malformed mirror masks the real cause. Memoizing restores the single-evaluation behaviour the old MANIFEST_URL const had. 6. PyPy and GraalPy ignore mirror. Neither installer reads the input, so it silently does nothing for pypy-*/graalpy-*. Worth a docs caveat or warning. 7. The E2E job doesn't exercise the new paths. setup-versions-via-mirror-input sets mirror to the default value, so it resolves to the same coordinates as a run with no mirror. A fork of actions/python-versions would at least cover non-default coordinates. Once those are addressed, happy to take another look. Thanks! |
Sorry, something went wrong.
|
I’m OoO this week but will absolutely rebase and address feedback next week! Thank you very much 🙏 |
Sorry, something went wrong.
|
Hi @luhenry, |
Sorry, something went wrong.
…bution sources Users who need custom CPython builds (internal mirrors, GHES-hosted forks, special build configurations, compliance builds, air-gapped runners) could not previously point setup-python at anything other than actions/python-versions. Adds two new inputs: - `mirror`: base URL hosting versions-manifest.json and the Python distributions it references. Defaults to the existing https://raw.githubusercontent.com/actions/python-versions/main. - `mirror-token`: optional token used to authenticate requests to the mirror. If `mirror` is a raw.githubusercontent.com/{owner}/{repo}/{branch} URL, the manifest is fetched via the GitHub REST API (authenticated rate limit applies); otherwise the action falls back to a direct GET of {mirror}/versions-manifest.json. Token interaction ----------------- `token` is never forwarded to arbitrary hosts. Auth resolution is per-URL: 1. if mirror-token is set, use mirror-token 2. else if token is set AND the target host is github.com, *.github.com, or *.githubusercontent.com, use token 3. else send no auth Cases: Default (no inputs set) mirror = default raw.githubusercontent.com URL, mirror-token empty, token = github.token. → manifest API call and tarball downloads use `token`. Identical to prior behavior. Custom raw.githubusercontent.com mirror (e.g. personal fork) mirror-token empty, token = github.token. → manifest API call and tarball downloads use `token` (target hosts are GitHub-owned). Custom non-GitHub mirror, no mirror-token mirror-token empty, token = github.token. → manifest fetched via direct URL (no auth attached), tarball downloads use no auth. `token` is NOT forwarded to the custom host — this is the leak-prevention case. Custom non-GitHub mirror with mirror-token mirror-token set, token may be set. → manifest fetch and tarball downloads use `mirror-token`. Custom GitHub mirror with both tokens set mirror-token wins. Used for both the manifest API call and tarball downloads.
How should I handle that? Are you happy to point to a "external" mirror (can be hosted on github as well)? But then your testing would take a dependency on this external mirror. |
Sorry, something went wrong.
- scope mirror-token to the mirror host and send it verbatim - route non-repo mirrors straight to the URL fetch instead of throwing - authenticate the manifest fetch - warn on slash branches, and on mirror with PyPy/GraalPy - memoize mirror validation - exercise the direct-URL path in the E2E job Addresses actions#1302 (comment) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Hello @luhenry👋, Thanks for the quick turnaround. A few more things worth a look: 1. The PyPy/GraalPy warning fires on every run. warnIfMirrorUnsupported() returns early on !core.getInput('mirror'), but action.yml gives mirror a default, so getInput always returns the default URL and the guard never trips. Every pypy-*/graalpy-* run now warns about an input the user never set. 2. setup-versions-via-mirror-input doesn't reach the mirror. 3.12 is preinstalled on all three images, so tc.find() short-circuits and the manifest is never fetched. The job passes without contacting the mirror it's meant to exercise, and would stay green even if the mirror code path regressed. check-latest: true (or an uncached patch like 3.11.7) would force the manifest fetch and make the job meaningful. 3. The slash-branch warning misfires on refs/heads/ URLs. REPO_COORDS_RE allows exactly three path segments, so https://raw.githubusercontent.com/actions/python-versions/refs/heads/main fails to match and falls into the "branch name contains a slash" branch, except the branch is main. The user gets told to remove a slash that isn't there, with no clear way to act on it. 4. That warning is also wrong about the consequence. It says the manifest is fetched by direct URL without the authenticated rate limit, and the docs caveat calls it "an anonymous direct GET with the 60/hr unauthenticated rate limit", but getManifestFromURL() calls authForUrl(), and raw.githubusercontent.com matches isGitHubHost(), so token is still sent. The new test sends token as a prefixed header for a GitHub-hosted raw manifest asserts exactly that, for this same URL shape. (Separately, raw.githubusercontent.com isn't the REST API, so the 60/hr figure doesn't apply to it either way.) On a real run: Warning: Could not parse owner/repo/branch out of mirror "https://raw.githubusercontent.com/actions/python-versions/refs/heads/main", so the manifest will be fetched by direct URL instead of the GitHub API. Branch names containing '/' are not supported; use a branch without a slash to get the authenticated API rate limit. Resolved as '3.12.10' Successfully set up CPython (3.12.10) Since that's the URL the new job uses, fixing (2) will surface this on every run. 5. getMirrorHost() swallows an invalid mirror. It catches the getMirror() throw and returns undefined, so authForUrl() quietly skips the mirror branch, while getManifestUrl() throws on the same input. The two disagree on whether a bad mirror is fatal. 6. Scheme-mismatch on the mirror host. getMirrorHost() returns URL.host, which carries the port but not the scheme, so a manifest served from https://mirror.example that lists a download_url at http://mirror.example/... still matches and mirror-token goes out in the clear. Also, the PR description's precedence list ("if mirror-token is set, use mirror-token") doesn't match authForUrl(), which only uses mirror-token when the target host equals the mirror host. Worth updating to the host-keyed behaviour the code implements. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description:
Users who need custom CPython builds (internal mirrors, GHES-hosted forks, special build configurations, compliance builds, air-gapped runners) could not previously point setup-python at anything other than actions/python-versions.
Adds two new inputs:
If mirror is a https://raw.githubusercontent.com/{owner}/{repo}/{branch} URL, the manifest is fetched via the GitHub REST API (authenticated rate limit applies); otherwise the action falls back to a direct GET of {mirror}/versions-manifest.json.
This approach is largely inspired from how it's done in actions/setup-node
Token interaction
token is never forwarded to arbitrary hosts. Auth resolution is per-URL:
Cases:
Default (no inputs set) mirror = default raw.githubusercontent.com URL, mirror-token empty, token = github.token. → manifest API call and tarball downloads use `token`. Identical to prior behavior. Custom raw.githubusercontent.com mirror (e.g. personal fork) mirror-token empty, token = github.token. → manifest API call and tarball downloads use `token` (target hosts are GitHub-owned). Custom non-GitHub mirror, no mirror-token mirror-token empty, token = github.token. → manifest fetched via direct URL (no auth attached), tarball downloads use no auth. `token` is NOT forwarded to the custom host — this is the leak-prevention case. Custom non-GitHub mirror with mirror-token mirror-token set, token may be set. → manifest fetch and tarball downloads use `mirror-token`. Custom GitHub mirror with both tokens set mirror-token wins. Used for both the manifest API call and tarball downloads.Related issue:
Fixes #1288
Check list: