turbo
32e5ab21 - feat: Install additional tools by name and version (#15124)

Commit
2 days ago
feat: Install additional tools by name and version (#15124) ### Description `setup.additionalTools` makes a repository write a URL, a SHA-256, a format, and an executable path for every platform of every tool. With this change a repository names a tool and an exact version. `turbo setup` finds the downloads, pins them in `turbo.lock`, and installs them. ```jsonc "setup": { "additionalTools": { "jq": "1.8.2", // short name "gh": { "version": "2.105.0", "from": "aqua:cli/cli" }, // explicit catalog entry "acme": { "version": "1.4.2", "artifacts": { /* unchanged */ } } } } ``` ```text turbo setup, local mode for each catalog declaration that turbo.lock does not record find the recipe short name -> names.tsv -> aqua registry recipe find the release <prefix><version>, <prefix>v<version>, v<version>, <version> pin each platform download once, hash, check that it unpacks or is a program write the entries to turbo.lock, each with options.source = "aqua:<package ID>" install from turbo.lock, as before ``` #### What changed - A tool value in `turbo.json` can be a version string or `{ version, from }`. The schema and types are regenerated. - The new `turborepo-setup-catalog` crate bundles a copy of the aqua registry (v4.591.0, 301 KB gzipped) and 705 short names from mise's registry. It reads recipes with the `aqua-registry` crate, pinned to `=2026.11.1`. `catalog/update.mjs` regenerates both files. - `turbo.lock` stores a resolved tool as an ordinary additional-tool entry. A recorded entry is reused only while it matches its declaration and has the exact shape that resolution writes. `source` is not part of task hashes. - `turborepo-download` gains `download_unpinned`, which follows HTTPS redirects without an expected digest. `read_metadata` is unchanged. #### Scope - Frozen mode, `--offline`, `--check`, `--force`, `--no-lock`, and `turbo run` never resolve. They follow `turbo.lock` or report drift. `--update-lock` resolves again an entry that lacks a platform. - Covers recipes that download a GitHub release asset or a URL, in `raw`, `zip`, `tar.gz`, and `tar` formats, on the five platforms that hosts install on. - Leaves out `tar.xz` and other formats, custom registries, publisher signature checks, and docs. The additional-tools docs are still in #14776. A platform that cannot be installed yet is left out of the lock entry with its reason, and resolution fails if that platform is the host's. #### Tradeoffs - The first download of an artifact is trust on first use. The digest lands in `turbo.lock` for review. Resolution never uses `TURBO_SETUP_ARTIFACT_MIRROR`, because a mirror would then decide the digest. - The host's artifact is downloaded twice on first use: once to pin it and once to install it. Resolution holds up to five downloads in memory at once, each capped at 256 MiB. - A Windows host cannot unpack a Unix archive that has symlinks, so it pins that archive without the unpack check. That branch has no test. - The catalog is a separate crate because `aqua-registry` depends on `rkyv`, whose `PartialEq` impls broke type inference in `turborepo-prune` and `turborepo-watch` tests. #### Blast radius For a repository without catalog declarations, the new step returns before any request, and the existing `turbo setup` output tests pass unchanged. One behavior changes for hand-declared tools: `--plan` now proposes a changed additional tool. On `main` it exits 1 with a drift error (I ran both). `Cargo.lock` gains 15 third-party crates. I did not measure the release binary size, and I ran nothing on Linux or Windows hosts. ### Testing Instructions I ran the built binary against real downloads on macOS arm64, in scratch repositories with their own tool store: - `"jq": "1.8.2"`, `"ripgrep": "15.2.0"`, `"protoc": "26.1"`, `"kustomize": "5.8.3"`, and `{ "version": "2.105.0", "from": "aqua:cli/cli" }` resolve, lock five platforms each, install, and report the declared version through `turbo exec`. - The locked SHA-256 of jq's Linux binary matches a fresh download of the locked URL. - A second run with `--offline` succeeds and leaves `turbo.lock` unchanged. - With `CI=1`, a changed version fails and names the tool. `--plan` proposes the change and leaves `turbo.lock` unchanged. - An unknown name, a version that does not exist, and `"zig": "0.17.0"` (`tar.xz`) each fail with the reason. To try it, add `"setup": { "additionalTools": { "jq": "1.8.2" } }` to a root `turbo.json` that sets `futureFlags.experimentalSetup`, then run `turbo setup --tools-only` and `turbo exec -- jq --version`.
Author
Parents
Loading