Repository navigation
Conversation
force-mirror input to skip GitHub-hosted Node.js downloads
76ae92e to
f095933
Compare
| if ( | ||
| this.isLatestSyntax(this.nodeInfo.versionSpec) || | ||
| this.nodeInfo.checkLatest | ||
| ) { | ||
| core.info('Attempt to resolve the latest version from mirror...'); | ||
| nodeJsVersions ??= await this.getNodeJsVersions(); | ||
| this.nodeInfo.versionSpec = ( | ||
| await this.findVersionInDist(nodeJsVersions) | ||
| ).replace(/^v/, ''); | ||
| core.info(`Resolved as '${this.nodeInfo.versionSpec}'`); |
There was a problem hiding this comment.
Question for maintainers: Should check-latest fail when the mirror is down?
In the normal flow, if check-latest can't fetch the manifest, the action logs it and moves on. In force-mirror mode, a failed fetch of the mirror's index.json fails the step. That seems right for "mirror only", but it is a difference.
| run: __tests__/verify-node.sh "${{ matrix.node-version }}" | ||
| shell: bash | ||
|
|
||
| force-mirror: |
There was a problem hiding this comment.
Question for maintainers: I'm adding a lot of jobs here. A total of 9. We should have an integration test, but do we want to limit which OS's this runs on potentially?
f095933 to
bf442c8
Compare
| const cachedPath = this.findVersionInHostedToolCacheDirectory(); | ||
| if (cachedPath) { | ||
| core.info(`Found in cache @ ${cachedPath}`); | ||
| this.addToolPath(cachedPath); | ||
| await this.verifyNodeVersion(cachedPath); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Quesiton for maintainers: With force-mirror: true, the action is still using a matching version from the runner's tool cache.
Should force-mirror skip the cache in this case? I tend to think we want to keep the cache usage
When force-mirror is true, setup-node skips the actions/node-versions manifest and downloads official builds only from the mirror (or nodejs.org). LTS aliases, latest syntax, and check-latest are resolved from the mirror's index.json. If the mirror download fails, the step fails instead of falling back to GitHub. Adds unit tests for force-mirror failure, parsing, and nightly behavior, plus e2e coverage in the versions workflow. Fixes actions#1412 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
a04b2fc to
ad205b6
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Description:
This PR adds a
force-mirrorinput for teams that must get Node.js from their own mirror.Right now,
mirroris only a fallback. setup-node checks GitHub first and uses the mirror only if the version isn't there. Some teams must get Node.js from their own mirror, and today they can't make setup-node do that.When
force-mirroristrue, setup-node downloads official builds only from themirrorURL. It never downloads them from GitHub.force-mirrordefaults tofalse, so nothing changes for current users.lts/*,latest, andcheck-latest) is looked up in the mirror'sindex.json.mirrorisn't set, setup-node logs an info message and downloads fromhttps://nodejs.org.Related issue:
Fixes #1412
Check list: