18 Commits
Author SHA1 Message Date
CJ c27b913b17 build(release): 0.1.1-rc.1, and its changelog entry (#18)
VERSION is 0.1.1-rc.1, and CHANGELOG.md has its entry, which becomes the release candidate's notes on GitHub.

Refs #1
2026-11-07 11:03:56 -07:00
CJandClaude Opus 5.5 8d8da01037 feat(tools): dotnet, the .NET SDK, as a shared toolchain (#7)
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node,
python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the
picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`,
`*.fsproj` or `global.json` at its top level suggests it in the new VM's
summary, the way `package.json` suggests node.

Refs #2. Thanks to @jsskeen-utah for the detailed request.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 10:44:25 -07:00
CJandClaude Opus 5.5 da804f0568 ci: devvm.dev shows the latest release's docs, next.devvm.dev shows main's (#16)
Two docs sites, from one Docs workflow (`.github/workflows/docs.yml`):

- **devvm.dev** shows the latest release's docs. The `release` job
builds a tag's `docs/` and the `deploy` job deploys it to GitHub Pages
(`github-pages` environment), on a published release that isn't a
prerelease, and on a `workflow_dispatch` with `site=devvm.dev` and `ref`
(a release tag; empty means the latest release, from `gh release view`).
The tag is checked against `^v[0-9]+\.[0-9]+\.[0-9]+$` through `env:`
before it's used, and checked out as `refs/tags/<tag>`. Pushes to main
no longer deploy devvm.dev.
- **next.devvm.dev** shows main's docs. On pushes to main that touch the
docs (the same paths anchor), or a dispatch with `site=next.devvm.dev`,
`check` lints and builds, then `next` builds with `hugo -s docs --minify
--config hugo.yaml,next.yaml`, checks out devvmhq/docs-next with
`DOCS_NEXT_DEPLOY_KEY` (environment `docs-next`, only after the build),
replaces everything but README.md, and commits `Build from devvm <short
sha>` as github-actions[bot], skipping an unchanged build. Its
concurrency group keeps pushes from racing.
- `docs/next.yaml` sets `baseURL: https://next.devvm.dev/`, Hextra's
`params.banner` (a note that links devvm.dev), and `noindex` both as a
site param and through `cascade`, so Hextra's head writes `noindex,
nofollow` on every page. `docs/layouts/robots.txt` adds `Disallow: /`
when the site's `noindex` is set. The build stays in Hugo's production
environment, so Hextra's minified, fingerprinted assets are the same as
devvm.dev's.
- PRs get the same lint and build as before, and nothing runs with an
environment or a secret on `pull_request`. Permissions: `contents: read`
at the top; only `deploy` has `pages: write` and `id-token: write`. The
publishing jobs set `cache: false` on mise-action (zizmor's
cache-poisoning, now that the workflow publishes on `release`), and so
does `check`.
- Docs: Contributing's Maintaining has a new section, The docs sites
(what deploys each, the hand redeploy, the key and environments,
Cloudflare Pages serving devvmhq/docs-next); Contributing's two mentions
of the deploy point at it; Upgrading's Trying a prerelease links
next.devvm.dev.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 09:02:34 -07:00
CJandClaude Opus 5.5 b3a188712f fix(tools): the host's mise trusts the system's and devvm's CAs (#9)
devvm's host mise didn't trust the CAs in ~/.config/devvm/ca, so behind a
network that inspects TLS, resolving the shared tools' versions failed with
UnknownIssuer and a message to check the connection.

The host mise and its download now trust the folder's checked CAs: mise gets
them as MISE_EXTRA_CA_CERTS, and on Linux also an SSL_CERT_FILE bundle of the
system's roots plus those CAs (SSL_CERT_DIR only when the user set neither
variable). On macOS, mise's Sigstore client still needs the CA trusted in the
Keychain, as the docs say. A certificate failure now shows tools_untrusted,
pointing at the CA docs.

Refs #1

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 08:33:56 -07:00
CJandClaude Opus 5.5 63e41118c6 feat(release): release candidates and betas, as GitHub prereleases (#13)
devvm can ship prereleases, such as release candidates and betas, for
people to try before a release is out. A prerelease's version is
`x.y.z-<word>.N`, such as `0.2.0-rc.1` or `0.2.0-beta.2`. `VERSION`
holds it, the tag is `v0.2.0-rc.1`, and it gets a `CHANGELOG.md` entry
as usual.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-06 23:36:15 -07:00
CJandClaude Opus 5.5 3c4e90da0c fix(tools): opencode's backend is named, so mise's registry can't move it to npm (#10)
## What this changes

**The cause.** The pin bump in 588ba6f9 moved devvm's mise, on the host
and in VMs, from 2026.10.7 to 2026.11.3. Starting with mise 2026.10.9
(jdx/mise#14295), mise's registry puts npm first for opencode 2.x. Here
is `registry/opencode.toml` at each version:

```toml
# v2026.10.7
backends = ["aqua:anomalyco/opencode"]

# v2026.11.3
backends = [
  { full = "npm:@opencode/cli", min_version = "2.0.0", options = { allow_builds = ["@opencode/cli"] } },
  "aqua:anomalyco/opencode",
]
```

devvm named opencode only as `opencode = "2"`, so mise 2026.11.3
resolved it to `npm:@opencode/cli`. That lock entry has no download for
any platform. As a result, every resolve warned that opencode 2.2.5
isn't published for every platform, opencode's tool image couldn't be
built, and the e2e check "the shared tools resolve to upstream's newest"
failed on every machine. opencode's GitHub releases still ship v2
binaries for every platform, musl included, along with a `SHA256SUMS`.

**The fix.** `assets/shared-tools/mise.toml` now has a `[tool_alias]`
table. It names the backend of every shared tool that isn't one of
mise's own `core:` tools, so the registry's choice can't move them:

- `opencode = "github:anomalyco/opencode"`: its GitHub releases. With
mise 2026.11.3, the aqua backend now gives opencode.ai URLs, and on musl
it gives the glibc tarball. The github backend gives musl VMs opencode's
own `-musl` build and records `provenance = "github-attestations"`.
- `claude`, `codex`, `pnpm` and `uv` keep the aqua backends they already
resolve to, so their lock entries are unchanged. They are named because
each of them already lists a second backend in the registry (http, npm,
npm, and asdf/pipx). That is how opencode's switch happened.
- node, bun, python, go and rust are mise's `core:` tools. None of them
changed between 2026.10.7 and 2026.11.3, so they are not aliased.

The other two places where mise picks a backend now follow the same
table:

- The step back (`lockVersions`) locks older versions from the backend
the newest one came from.
- Each project VM's `/etc/mise/config.toml` gets the same table, sent as
`tool-alias.toml` in the setup. Without it, the VM's mise 2026.11.3
reports opencode's backend as npm, and a non-shared version would be
installed from npm.

`tests/e2e-mise.lock` was resolved again with mise 2026.11.3 through
`scripts/bump.sh e2e-tools`. It now has lockfile version 4 and opencode
from GitHub. codex stays at 0.166.0, because mise's latest for codex is
still the older 0.163.0.

**The guard.** `TestToolBackendsNamed` fails in two cases: when a shared
tool that isn't on a `core:` backend has no `[tool_alias]` entry, and
when an alias isn't the backend that `tests/e2e-mise.lock` resolved. On
main it would have failed for claude, codex, opencode, pnpm and uv. The
existing download-per-platform check (`TestE2ELockPins`) couldn't catch
this regression, because the e2e lock had never been resolved again with
2026.11.3. `TestAliases` covers the VM's table, and
`TestRefreshStepsBack` now checks the step back's `mise.toml`.

Docs: internals/images.md (Versions) explains the aliases.
contributing/maintaining.md says where a new shared tool's alias goes
and what the test checks.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-06 18:52:16 -07:00
CJandClaude Opus 5.5 062c89c913 ci: the docs deploy from main only when the docs change (#12)
## What this changes

The Docs workflow deploys from `main` only when a push changes the docs:
`docs/**`, Markdown files, the Vale and markdownlint config, or
`docs.yml` itself. Both triggers use one path list (a YAML anchor), so
they can't drift apart. `workflow_dispatch` still deploys by hand.

Why it's safe:
- The site is built from `docs/` alone; Hugo mounts nothing outside it.
- The generated CLI reference is in `docs/content/docs/cli/`, and
`TestReferenceIsCurrent` makes a help change commit it there, so those
pushes still deploy.
- The Hextra theme's version is in `docs/go.mod`, so its updates still
deploy.
- CI's `mise run lint` runs the docs checks (Vale, markdownlint,
`TestDocLinks`, `TestCommandLines`) on every code change, so skipping
this workflow loses no checking.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-06 18:50:29 -07:00
dependabot[bot] a965e68651 build(deps): bump github.com/spf13/pflag from 1.0.9 to 1.0.10 in the go group across 1 directory (#8)
Updates github.com/spf13/pflag from 1.0.9 to 1.0.10: a deprecation comment fix (spf13/pflag#447) and no errors.Is, for old Go versions (spf13/pflag#448).

https://github.com/spf13/pflag/compare/v1.0.9...v1.0.10

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-06 18:33:05 -07:00
w3cjandClaude Opus 5.5 770cb99329 build(deps): go-i18n 2.7.0, and pflag stays on 1.0.x
pflag 1.1 prints every boolean flag as --flag[=true|false] in the help, with no way to turn
it off, so Dependabot ignores pflag 1.1 and later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 12:53:26 -07:00
w3cjandClaude Opus 5.5 588ba6f9a1 build: bump docker 29.9.3, mise 2026.11.3, rustup 1.29.3, oh-my-bash, tealdeer 1.9.1 and the --from digests
docker 29.9.3, containerd 2.4.2, buildx 0.38.1, compose 5.7.0, model 1.2.9;
mise 2026.11.3 (VMs and the host mise); rustup 1.29.3; oh-my-bash 94c2977;
tealdeer 1.9.1; e2e's node:24 and alpine:3 digests. Every checksum is from
upstream's published sums.

bump.sh's value check now knows a Go constant's camelCase *Digest name, which
it refused before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:53:56 -07:00
w3cjandClaude Opus 5.5 1276474123 ci: a weekly check of the pins scripts/bump.sh keeps, as an issue
Mondays, scripts/bump.sh --check runs and its outdated lines go into one
open issue, "Pinned versions to bump", created or updated with gh and
--body-file; with none left the issue is closed. bump.sh's output passes
through files only. maintaining.md says what to do with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:36:38 -07:00
w3cjandClaude Opus 5.5 22387c5b78 fix(scripts): bump.sh --check never offers an older version as the latest
When upstream's latest is a version older than the pin (a release marker
that lags, as codex's and opencode's have), report() says the pin is newer
and neither counts it as outdated nor bumps it. Digests and dated releases
are compared as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:32:37 -07:00
w3cjandClaude Opus 5.5 c3a262bec9 ci: Dependabot's updates come monthly
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:31:30 -07:00
w3cjandClaude Opus 5.5 5fb0732580 ci: Dependabot's weekly updates for Go modules and pinned actions, a week after each release
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:25:51 -07:00
w3cjandClaude Opus 5.5 1a6d653431 chore(github): a pull request template, and every pull request asks the maintainer for a review
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:25:51 -07:00
w3cjandClaude Opus 5.5 57cf548b31 ci: pull request titles follow Conventional Commits, as squash merges take them as the subject
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:18:53 -07:00
w3cjandClaude Opus 5.5 b24da31e41 build: Lima 2.3 in CI, bump.sh e2e-lima, and Lima 2.2 as devvm's minimum
CI's e2e workflow installs Lima 2.3.0, its tarball's checksum taken from the release's SHA256SUMS, checked against the sha256 Lima's release notes publish. scripts/bump.sh e2e-lima moves that pin the same way. devvm's doctor, install.sh, the README and the Lima page ask for Lima 2.2 or newer, compared by major and minor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 09:57:01 -07:00
w3cjandClaude Opus 5.5 f3e4753445 build(release): the Homebrew formula installs the release's signed binary
The formula has an archive per platform (macOS and Linux, arm64 and
Intel), each URL and checksum filled in by release.sh from the
SHA256SUMS it wrote, and installs only the binary; no Go dependency.
release.sh --formula-from DIR writes the formula for a published
release from its downloaded SHA256SUMS, checked against minisign.pub.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 09:34:18 -07:00
101 changed files with 2866 additions and 342 deletions

No files matched your search

+1 -1
View File
@@ -63,7 +63,7 @@ Use these terms on every page and in every message.
- **Feature** on user pages means only base image features (omb, fzf, cli-tools) and devcontainer features. Backend features, which are native, emulated or none, appear only on the How it works pages. devvm doctor prints backend features as "features", so say so where a user page compares backends.
- **Image** means devvm's images, such as base or foo+bar. Say "container image" for the images that `--from` and a `devcontainer.json` start from.
- **Layer** means devvm's layers. Say "Docker's image layers" when you mean Docker's.
- **Shared tool** means node, python, rust, go, claude, codex or opencode.
- **Shared tool** means node, python, rust, go, dotnet, claude, codex or opencode.
## Workflow
+2
View File
@@ -0,0 +1,2 @@
# Every pull request asks the maintainer for a review.
* @w3cj
+7 -7
View File
@@ -1,5 +1,5 @@
name: Toolchain request
description: A language or runtime you'd like devvm to build in, such as .NET, Java, PHP, Ruby or Elixir.
description: A language or runtime you'd like devvm to build in, such as Java, PHP, Ruby or Elixir.
labels: ["enhancement", "toolchain", "triage"]
body:
- type: markdown
@@ -18,7 +18,7 @@ body:
attributes:
label: The toolchain
description: Its usual name, and its mise tool name if you know it (what `mise registry NAME` prints).
placeholder: .NET (mise's dotnet)
placeholder: Ruby (mise's ruby)
validations:
required: true
- type: textarea
@@ -26,7 +26,7 @@ body:
attributes:
label: Files that should pick it
description: The project files that tell devvm a folder needs this toolchain.
placeholder: "*.csproj, *.sln, global.json"
placeholder: "Gemfile, .ruby-version"
validations:
required: true
- type: textarea
@@ -41,25 +41,25 @@ body:
attributes:
label: Versions
description: Whether the latest is enough or you need several major versions, and which.
placeholder: The latest LTS, and 8 for older projects
placeholder: The latest, and 3.3 for older projects
- type: input
id: source
attributes:
label: Official install source
description: Where the toolchain's own builds come from.
placeholder: https://dotnet.microsoft.com/download
placeholder: https://www.ruby-lang.org/en/downloads/
- type: textarea
id: registries
attributes:
label: Package managers and their hosts
description: The package managers people use with it and the hosts they download from, which the toolchain's network policy lets through.
placeholder: "NuGet: api.nuget.org, globalcdn.nuget.org"
placeholder: "RubyGems: rubygems.org, index.rubygems.org"
- type: textarea
id: writes
attributes:
label: What it writes into its own folder
description: Global installs, plugins or self-updates that write into the toolchain's install folder, which devvm has to send somewhere else because shared tools are read-only in VMs.
placeholder: "`dotnet tool install -g` writes to ~/.dotnet/tools"
placeholder: "`gem install` writes into Ruby's own gems folder"
- type: dropdown
id: builds
attributes:
+35
View File
@@ -0,0 +1,35 @@
# Monthly updates, each ecosystem in one grouped pull request, for devvm's Go modules and the actions its workflows pin by SHA. Their titles follow
# Conventional Commits, as the PR title check asks. Pinned downloads in assets/, the shared tools' lock
# and the e2e pins are bumped with scripts/bump.sh, which Dependabot doesn't know.
version: 2
updates:
- package-ecosystem: gomod
directories: ["/", "/docs"]
schedule:
interval: monthly
# A release has a week to be found bad before an update proposes it.
cooldown:
default-days: 7
commit-message:
prefix: build
include: scope
# pflag 1.1 prints every boolean flag as --flag[=true|false] in the help, with no way to turn it
# off, so devvm stays on 1.0.x.
ignore:
- dependency-name: github.com/spf13/pflag
versions: [">= 1.1.0"]
groups:
go:
patterns: ["*"]
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
cooldown:
default-days: 7
commit-message:
prefix: ci
include: scope
groups:
actions:
patterns: ["*"]
+16
View File
@@ -0,0 +1,16 @@
<!-- markdownlint-disable-file MD041 -- a pull request's body, under GitHub's own title -->
## What this changes
<!-- What the change does and why. Link the issue it fixes, as in "Fixes #12". -->
## How it was tested
<!-- The tests you added or ran. For a change that touches VMs, the e2e sections you ran (mise run e2e -- --only SECTION) and on which OS. -->
## Checklist
- [ ] The title is a Conventional Commit, `type(scope): summary`, because it becomes the squashed commit's subject.
- [ ] `mise run fmt && mise run lint && mise run test` passes.
- [ ] New behaviour has tests, and every behaviour change updates its page in `docs/content/docs/`.
- [ ] A changed command follows the cli skill, and `mise run cli-docs` is rerun when its help changed.
- [ ] Nothing here belongs in a private security advisory instead (see SECURITY.md).
+136 -13
View File
@@ -1,30 +1,53 @@
name: Docs
# Pull requests touching the docs get their lints and a build; main deploys.
# Two sites. devvm.dev shows the latest release's docs: a published release that isn't a
# prerelease deploys its tag's docs to GitHub Pages, and so does a dispatch, with any release's
# tag. next.devvm.dev shows main's: each push to main that changes the docs builds them with
# docs/next.yaml and commits the site to devvmhq/docs-next, which Cloudflare Pages serves.
# Pull requests touching the docs get their lints and a build, and nothing else.
# The site is built from docs/ alone (the CLI reference included, which a help change commits
# there), and CI's lint runs the docs checks on every code change, so other pushes skip this.
# A release event runs this file as its tag has it.
on:
push:
branches: [main]
pull_request:
paths:
paths: &docs-paths
- "docs/**"
- "**.md"
- ".vale.ini"
- ".vale/**"
- ".markdownlint-cli2.yaml"
- ".github/workflows/docs.yml"
pull_request:
paths: *docs-paths
release:
types: [published]
workflow_dispatch:
inputs:
site:
description: The site to deploy
type: choice
options: [devvm.dev, next.devvm.dev]
default: devvm.dev
ref:
description: "devvm.dev only: the release tag whose docs it shows, such as v0.1.0 (empty: the latest release)"
type: string
required: false
permissions:
contents: read
# Deploys queue one after another; a pull request's newer run replaces its last.
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
# main's docs, or a pull request's: the lints and a build.
check:
if: >-
github.event_name == 'pull_request' || github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs.site == 'next.devvm.dev')
runs-on: ubuntu-latest
# A pull request's newer run replaces its last.
concurrency:
group: docs-check-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Only the docs' tools, not every tool in mise.toml.
MISE_TASK_RUN_AUTO_INSTALL: "false"
@@ -38,18 +61,118 @@ jobs:
with:
version: 2026.10.18
install_args: go hugo-extended node markdownlint-cli2 vale lychee
# The workflow publishes, so no job in it reads a cache another run could have written.
cache: false
- run: mise run lint:docs
# The site's address is baseURL in docs/hugo.yaml.
- run: hugo -s docs --minify
- if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
# next.devvm.dev: main's docs, committed to devvmhq/docs-next.
next:
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && inputs.site == 'next.devvm.dev'))
needs: check
runs-on: ubuntu-latest
# One push at a time; a newer run waiting replaces an older one.
concurrency:
group: docs-next
cancel-in-progress: false
# The environment holds the deploy key, and only main can use it.
environment:
name: docs-next
url: https://next.devvm.dev/
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
- uses: jdx/mise-action@6be3c7ed4c21d4f76b208d351d95aac273ebb76d # v5.2.4
with:
version: 2026.10.18
install_args: go hugo-extended
# What's published is built from no cache.
cache: false
# docs/next.yaml over docs/hugo.yaml: next.devvm.dev's address, the banner and noindex.
- run: hugo -s docs --minify --config hugo.yaml,next.yaml -d "$RUNNER_TEMP/next"
# The key is checked out only after the build, which never sees it.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: devvmhq/docs-next
ref: main
path: docs-next
ssh-key: ${{ secrets.DOCS_NEXT_DEPLOY_KEY }}
# The push below needs the key; this checkout is the only thing that uses it.
persist-credentials: true # zizmor: ignore[artipacked] -- the push needs the deploy key, and nothing is uploaded
- name: Publish
working-directory: docs-next
run: |
# Everything but README.md is the site's.
find . -mindepth 1 -maxdepth 1 ! -name .git ! -name README.md -exec rm -rf {} +
cp -R "$RUNNER_TEMP/next/." .
git add -A
if git diff --cached --quiet; then
echo "next.devvm.dev is already this build."
exit 0
fi
git -c user.name="github-actions[bot]" \
-c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -q -m "Build from devvm ${GITHUB_SHA::7}"
git push origin HEAD:main
# devvm.dev: a release's docs, built from its tag.
release:
if: >-
(github.event_name == 'release' && !github.event.release.prerelease) ||
(github.event_name == 'workflow_dispatch' && inputs.site == 'devvm.dev')
runs-on: ubuntu-latest
steps:
- id: tag
name: The release's tag
env:
GH_TOKEN: ${{ github.token }}
EVENT: ${{ github.event_name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
INPUT_REF: ${{ inputs.ref }}
run: |
if [ "$EVENT" = release ]; then
tag=$RELEASE_TAG
elif [ -n "$INPUT_REF" ]; then
tag=$INPUT_REF
else
tag=$(gh release view --repo devvmhq/devvm --json tagName --jq .tagName)
fi
if ! [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::A release tag is vX.Y.Z, such as v0.1.0; this is $tag."
exit 1
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: refs/tags/${{ steps.tag.outputs.tag }}
persist-credentials: false
# Full history, for each page's last updated date.
fetch-depth: 0
- uses: jdx/mise-action@6be3c7ed4c21d4f76b208d351d95aac273ebb76d # v5.2.4
with:
version: 2026.10.18
install_args: go hugo-extended
# What's published is built from no cache.
cache: false
# The tag's docs/hugo.yaml, whose baseURL is devvm.dev.
- run: hugo -s docs --minify
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: docs/public
deploy:
if: github.event_name != 'pull_request'
needs: build
needs: release
runs-on: ubuntu-latest
# Deploys queue one after another.
concurrency:
group: docs-pages
cancel-in-progress: false
permissions:
pages: write # to deploy the site
id-token: write # to prove the deployment comes from this workflow
+4 -3
View File
@@ -15,9 +15,10 @@ concurrency:
cancel-in-progress: false
env:
LIMA_VERSION: 2.2.1
# lima-2.2.1-Linux-x86_64.tar.gz in the release's SHA256SUMS.
LIMA_SHA256: b391ac7fcac2b2a5a1628107756463188ded4d18d3104a40a66a8bb6fec01bcb
LIMA_VERSION: 2.3.0
# lima-$LIMA_VERSION-Linux-x86_64.tar.gz in the release's SHA256SUMS
# (scripts/bump.sh e2e-lima).
LIMA_SHA256: cc8ba97f1c801b899f7c9eda9919dfc4ce4fa2c140c53e5add15aa2d0a1936f9
jobs:
project:
+66
View File
@@ -0,0 +1,66 @@
name: Pins
# scripts/bump.sh --check once a week: the pins with a newer upstream go in
# one open issue, which closes when none is left. It reports and never bumps.
on:
schedule:
- cron: "47 6 * * 1"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pins
cancel-in-progress: false
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
issues: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check the pins
run: |
set -euo pipefail
scripts/bump.sh --check | tee "$RUNNER_TEMP/check.txt"
# bump.sh's output is upstream's text: it goes through files, never into
# a script.
- name: Open, update or close the issue
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
title="Pinned versions to bump"
grep -F ' -> ' "$RUNNER_TEMP/check.txt" > "$RUNNER_TEMP/outdated.txt" || true
number=$(gh issue list --state open --search "in:title \"$title\"" --json number,title \
--jq "map(select(.title == \"$title\")) | .[0].number // empty")
if [[ ! -s $RUNNER_TEMP/outdated.txt ]]; then
if [[ -n $number ]]; then
gh issue close "$number" --comment "Every pin is up to date: scripts/bump.sh --check lists nothing to bump."
fi
exit 0
fi
{
echo "scripts/bump.sh --check found pins with a newer upstream version:"
echo
# Four backticks: a line from upstream can't end the block early.
echo '````'
cat "$RUNNER_TEMP/outdated.txt"
echo '````'
echo
echo "Bump them with \`scripts/bump.sh TOOL…\` (the tools named above), or \`scripts/bump.sh\` for all."
echo "Pin bumps change images, so run the \`--from\` tier of the end-to-end tests before merging:"
echo "see [Updating pinned versions](https://devvm.dev/docs/contributing/maintaining/#updating-pinned-versions)."
} > "$RUNNER_TEMP/body.md"
if [[ -n $number ]]; then
gh issue edit "$number" --body-file "$RUNNER_TEMP/body.md"
else
gh issue create --title "$title" --label enhancement --body-file "$RUNNER_TEMP/body.md"
fi
+38
View File
@@ -0,0 +1,38 @@
name: PR title
# Pull requests are squash-merged with their title as the commit's subject, so the title follows
# Conventional Commits, with the types AGENTS.md lists. pull_request, not pull_request_target: the
# check only reads the title through the API with a read-only token and checks out no code.
on:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions:
contents: read
concurrency:
group: pr-title-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
title:
name: Conventional Commits title
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
steps:
- uses: amannn/action-semantic-pull-request@2252a14e810aa9b85c2d560bd7070c802206ecf6 # v6.1.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
feat
fix
docs
test
refactor
build
ci
chore
requireScope: false
+1 -1
View File
@@ -114,7 +114,7 @@ devvm: one isolated VM per project folder, cloned from a base image, with toolch
- **Unit tests** are Go table tests next to the code; **CLI tests** are testscript against the built binary in a `/tmp` sandbox in names mode, stubs first on `PATH` (`stub_calls`, `stub_reset`), with `project`, `vm_name`, `catg`, `vm_state`, `json_set` and `$DATA`/`$VMS`/`$RUN`/`$CFG`; the binary has `assets/` embedded (no override: scripts read `$DEVVM_REPO/assets/`; rebuild before a manual run after editing them). New logic needs a test. Neither touches the Keychain, real VMs or the user's folders; state-writing tests point the XDG folders at `t.TempDir()`. Go tests never run up: scripts do.
- **Never touch VMs, images or containers devvm's tests didn't make:** your own stay as they are. Manual runs: `DEVVM_LIMA_HOME=~/.lt LIMA_HOME=~/.lt XDG_DATA_HOME=/tmp/x/data XDG_CONFIG_HOME=/tmp/x/config DEVVM_SECRET_SERVICE=devvm-sandbox-test` (devvm's Lima home is `$XDG_DATA_HOME/devvm/lima` unless `DEVVM_LIMA_HOME`; `LIMA_HOME` is for your `limactl`). Add a `config.toml` with `features = []` and pass `--network TIER` so nothing prompts. Delete test Keychain items. Never use your own tokens or logins: a network-policy VM reads its agent's login file from `HOME`, so give it its own (the Keychain needs the real `HOME`: test it apart).
- **End-to-end:** `mise run e2e -- FLAGS` (`--only`, `--from`, `--clean`, `--slots`, `--golden`…) builds devvm from the checkout and drives real VMs in its sandbox (`~/.lt-e2e-go`, `/tmp/devvm-go-e2e`, service `devvm-go-e2e`), deleting only what it made; images stay cached (`--clean`). `--slots N` spreads the sections over N sandboxes at once (slot K's paths end `-K`, its ports +100·K, its images cloned from slot 0's). Only `tools` resolves the newest tool versions; the rest use the pinned lock, and `--from` images go by pinned digest but one tag (`scripts/bump.sh e2e-tools e2e-from`). Run it in the background. Sections: `images`, `project`, `clone` (a throwaway repo, its own `HOME`), `gc` (an `img-*` folder's VM, a stale fixture), `tools` (a node VM), `network` (a VM with Claude Code, Codex and opencode), `desktop` (a base VM refused, then the desktop layer, devvm desktop), `nix` (a node VM with the nix layer and a flake), `from` (Debian 12, Alpine and Ubuntu bases, a docker that isn't running), `link` (two targets and a client, then the three in a group, the design note's threat check). Tiers: none (all but `desktop` and `from`, no features); `--from` (everything, every feature; before merging `assets/` or `--from` changes); `--only a,b` (with `from`: every feature). Hosted CI can't run it on macOS.
- **End-to-end:** `mise run e2e -- FLAGS` (`--only`, `--from`, `--clean`, `--slots`, `--golden`…) builds devvm from the checkout and drives real VMs in its sandbox (`~/.lt-e2e-go`, `/tmp/devvm-go-e2e`, service `devvm-go-e2e`), deleting only what it made; images stay cached (`--clean`). `--slots N` spreads the sections over N sandboxes at once (slot K's paths end `-K`, its ports +100·K, its images cloned from slot 0's). Only `tools` resolves the newest tool versions; the rest use the pinned lock, and `--from` images go by pinned digest but one tag (`scripts/bump.sh e2e-tools e2e-from`). Run it in the background. Sections: `images`, `project`, `clone` (a throwaway repo, its own `HOME`), `gc` (an `img-*` folder's VM, a stale fixture), `tools` (a node VM, a .NET one), `network` (a VM with Claude Code, Codex and opencode), `desktop` (a base VM refused, then the desktop layer, devvm desktop), `nix` (a node VM with the nix layer and a flake), `from` (Debian 12, Alpine and Ubuntu bases, a docker that isn't running), `link` (two targets and a client, then the three in a group, the design note's threat check). Tiers: none (all but `desktop` and `from`, no features); `--from` (everything, every feature; before merging `assets/` or `--from` changes); `--only a,b` (with `from`: every feature). Hosted CI can't run it on macOS.
- **Linux hosts:** `LIMA_HOME=~/.lt-linux-go`, VM `linuxhost` (nested virtualization, the repo read-only, copied to `~/devvm`), set up as [testing.md](docs/content/docs/contributing/testing.md) says, apart from any Lima home of your own.
- **Unreviewed emulations** are checked through `DEVVM_UNREVIEWED=backend:feature`, which only test builds (e2e's, the CLI tests', by ldflags) read.
- **Delete test VMs and temp files afterwards.** Long builds run in the background. Tests that `chflags` real files unlock them (`chflags -R nouchg`), only in their own temp folders.
+10
View File
@@ -1,5 +1,15 @@
# Changelog
## 0.1.1-rc.1
A release candidate for 0.1.1, for trying the changes below before the release. Install it with `devvm upgrade --to 0.1.1-rc.1`, or with the install script's `--version 0.1.1-rc.1`. Homebrew stays on 0.1.0.
- **A dotnet toolchain:** the .NET SDK is a shared toolchain, chosen by a folder's `*.sln`, `*.slnx`, `*.csproj`, `*.fsproj` or `global.json`, and a `global.json`'s `sdk.version` picks the SDK. devvm downloads Microsoft's archive for each platform and checks its SHA-512, global tools and workloads go to the VM's home folder, and the .NET CLI's telemetry is off ([toolchains](https://next.devvm.dev/docs/using/toolchains/)).
- **A network that inspects TLS:** devvm's own mise, which looks up the shared tools' versions on this machine, now trusts the CAs in `~/.config/devvm/ca` as well as the system's, so resolving works behind a proxy that re-signs HTTPS. When a certificate isn't trusted, devvm says so and points to the docs instead of saying to check the connection. On macOS, the CA also has to be trusted in the Keychain.
- **Release candidates:** devvm can ship prereleases, such as this one. `devvm upgrade --to` installs one, and devvm upgrade, the release check and the install script's default never pick one on their own.
- **Lima 2.2 or newer:** devvm needs Lima 2.2 at least, and it's tested with Lima 2.3. `devvm doctor` says when Lima is older.
- **Updated pins:** base's docker is 29.9.3, mise 2026.11.3, rustup 1.29.3, and tealdeer 1.9.1, with a newer oh-my-bash. The shared tools' backends are named, so mise's registry can't switch opencode to a source with no downloads. base installs ICU, which .NET needs, so base and every image built on it are built again once.
## 0.1.0
Released 2026-11-06.
+2
View File
@@ -9,3 +9,5 @@ Before sending a change, run:
```sh
mise run fmt && mise run lint && mise run test
```
Pull requests are squash-merged, and the pull request's title becomes the commit's subject, so write it as a [Conventional Commit](https://www.conventionalcommits.org/), `type(scope): summary`, with a type of `feat`, `fix`, `docs`, `test`, `refactor`, `build`, `ci` or `chore`. A check fails a title that doesn't follow it.
+2 -2
View File
@@ -30,7 +30,7 @@ Then run `devvm doctor`, which checks what devvm needs on your machine and says
Each release is signed with devvm's minisign key, `RWSjzFsn7ETaijKJ2y7F4DtZobXmyv+LmdclJwZP/KmAkLUwOCzWF/2b`, and [Checking the install script](https://devvm.dev/docs/internals/install/#checking-the-install-script) shows how to check the script with it before you run it.
- **Requirements:** macOS 13 or newer, or Linux, on arm64 or x86_64, with Lima 2.0 or newer ([Lima's requirements](https://devvm.dev/docs/backends/lima/#requirements)).
- **Requirements:** macOS 13 or newer, or Linux, on arm64 or x86_64, with Lima 2.2 or newer ([Lima's requirements](https://devvm.dev/docs/backends/lima/#requirements)).
- **Tested on** Apple silicon Macs and on Linux on arm64 and x86_64, but not yet on Intel Macs.
- [Installing](https://devvm.dev/docs/getting-started/install/) has the full list of requirements and the install script's options, and [Upgrading and uninstalling](https://devvm.dev/docs/using/upgrading/) covers what comes later.
@@ -58,7 +58,7 @@ devvm
## What's supported
- **Toolchains:** devvm detects them from the project's files, so a folder with `package.json` gets node ([toolchains](https://devvm.dev/docs/using/toolchains/)).
- **Toolchains:** node, python, rust, go and dotnet. devvm detects them from the project's files, so a folder with `package.json` gets node ([toolchains](https://devvm.dev/docs/using/toolchains/)).
- **Coding agents:** Claude Code, Codex and opencode run in the VM, with your settings, skills and MCP servers. devvm keeps their settings and logins in a store of its own, and `devvm agent import` copies them in from an agent you already use on your machine ([coding agents](https://devvm.dev/docs/using/coding-agents/)).
- **Layers:** the built-in `docker`, `nix` and `desktop` layers, and your own from `devvm layer new` ([layers](https://devvm.dev/docs/using/images/#layers)).
- **Backend:** devvm runs its VMs on [Lima](https://lima-vm.io) ([backends](https://devvm.dev/docs/backends/)).
+1 -1
View File
@@ -1 +1 @@
0.1.0
0.1.1-rc.1
+73 -9
View File
@@ -1,28 +1,92 @@
package assets
import (
"crypto/sha256"
"crypto/sha512"
"encoding/hex"
"io/fs"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
)
// Every VM's shells get the tools' environment from base's
// /etc/profile.d/devvm-tools.sh, which turns off the agents'
// self-updates: their installs are read-only shared tools, and mise pins
// their versions.
func TestToolsEnvironment(t *testing.T) {
// heredoc is the body of the heredoc that base.sh starts with this line,
// up to its end marker.
func heredoc(t *testing.T, start, end string) string {
t.Helper()
b, err := fs.ReadFile(FS, "layers/base.sh")
if err != nil {
t.Fatal(err)
}
_, rest, ok := strings.Cut(string(b), "/etc/profile.d/devvm-tools.sh >/dev/null <<'SH'\n")
block, _, closed := strings.Cut(rest, "\nSH\n")
_, rest, ok := strings.Cut(string(b), start+"\n")
block, _, closed := strings.Cut(rest, "\n"+end+"\n")
if !ok || !closed {
t.Fatal("base.sh writes no /etc/profile.d/devvm-tools.sh")
t.Fatalf("base.sh has no %q", start)
}
for _, line := range []string{"export DISABLE_AUTOUPDATER=1", "export OPENCODE_DISABLE_AUTOUPDATE=1"} {
return block
}
// Every VM's shells get the tools' environment from base's
// /etc/profile.d/devvm-tools.sh, which turns off the agents'
// self-updates: their installs are read-only shared tools, and mise pins
// their versions. It turns off .NET's telemetry, first-run banner, profile
// edit and workload update check too, and puts its global tools on the
// PATH.
func TestToolsEnvironment(t *testing.T) {
block := heredoc(t, "sudo tee /etc/profile.d/devvm-tools.sh >/dev/null <<'SH'", "SH")
for _, line := range []string{
"export DISABLE_AUTOUPDATER=1", "export OPENCODE_DISABLE_AUTOUPDATE=1",
"export DOTNET_CLI_TELEMETRY_OPTOUT=1", "export DOTNET_NOLOGO=1",
"export DOTNET_ADD_GLOBAL_TOOLS_TO_PATH=false", "export DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE=true",
} {
if !strings.Contains("\n"+block+"\n", "\n"+line+"\n") {
t.Errorf("devvm-tools.sh lacks %q", line)
}
}
for _, dir := range []string{"$HOME/.npm-global/bin:", "$HOME/go/bin:", "$HOME/.cargo/bin:", "$HOME/.dotnet/tools:", "$HOME/.local/bin:"} {
if !strings.Contains(block, `export PATH="`) || !strings.Contains(block, dir) {
t.Errorf("devvm-tools.sh's PATH lacks %s", dir)
}
}
}
// base.sh's devvm-fetch keeps a download only when its checksum is the
// one given: a SHA-256, or a SHA-512 by its length.
func TestDevvmFetch(t *testing.T) {
for _, c := range []string{"sh", "curl", "sha256sum", "sha512sum", "cut"} {
if _, err := exec.LookPath(c); err != nil {
t.Skip("no " + c)
}
}
dir := t.TempDir()
script := filepath.Join(dir, "devvm-fetch")
if err := os.WriteFile(script, []byte(heredoc(t, "sudo tee /usr/local/bin/devvm-fetch >/dev/null <<'SH'", "SH")+"\n"), 0o600); err != nil {
t.Fatal(err)
}
src := filepath.Join(dir, "src")
body := []byte("an archive\n")
if err := os.WriteFile(src, body, 0o600); err != nil {
t.Fatal(err)
}
s256, s512 := sha256.Sum256(body), sha512.Sum512(body)
for _, tc := range []struct {
name, sum string
ok bool
}{
{"its SHA-256", hex.EncodeToString(s256[:]), true},
{"its SHA-512", hex.EncodeToString(s512[:]), true},
{"another SHA-256", strings.Repeat("0", 64), false},
{"another SHA-512", strings.Repeat("0", 128), false},
{"its SHA-256 twice", strings.Repeat(hex.EncodeToString(s256[:]), 2), false},
} {
out := filepath.Join(dir, "out")
err := exec.CommandContext(t.Context(), "sh", script, "file://"+src, tc.sum, out).Run() //nolint:gosec // base.sh's devvm-fetch, on the test's own files
_, kept := os.Stat(out)
if (err == nil) != tc.ok || (kept == nil) != tc.ok {
t.Errorf("%s: %v, kept %v", tc.name, err, kept == nil)
}
_ = os.Remove(out)
}
}
+3 -3
View File
@@ -8,9 +8,9 @@ set -euxo pipefail
eza_version=0.23.5
eza_sha256_arm64=40b87ae8628aa2ff0f0d2dc24ab52f689631366385c3da630bae745671fd71ec
eza_sha256_amd64=e06eebab74b73d6b7d51a796a353824b001bea82df077706382e100815d28904
tealdeer_version=1.9.0
tealdeer_sha256_arm64=a748f181c00933980cb850f4a24199c45900fc523787f6c524232a6bfc66b895
tealdeer_sha256_amd64=dc7263b550e90c0689ea2cb434e3144469805d5dddecbb1f7fc534e1185b7408
tealdeer_version=1.9.1
tealdeer_sha256_arm64=247746dd2d18f0135da79b849bb6b49e45262e2fe4318adfc3082dc6ce3ee968
tealdeer_sha256_amd64=5a9c3f0691b9cf375ee5c99de802885f3d50498cf686a539e2ddda028eb6b4f6
if [[ $devvm_libc == musl ]]; then
# Alpine packages eza too (its arm64 release build below is glibc).
+1 -1
View File
@@ -2,7 +2,7 @@
# oh-my-bash: themed prompt, completions, aliases
set -euxo pipefail
# Pinned commit (scripts/bump.sh updates it); git checks the content against it.
omb_commit=abf846186ab0a8a41ec5888e827ece6277dfe446
omb_commit=94c2977eda06f230aafa9628fcd869123f01896b
# Its own installer, from the pinned commit and cloning from it (OSH_REPOSITORY), so nothing comes
# from master. Replaces ~/.bashrc (backed up first); re-add the ~/.bashrc.d loader afterwards.
+1 -1
View File
@@ -30,7 +30,7 @@ The VM doesn't record its tier, and the user sees it with devvm network on the h
## Tools and installs
- The toolchains (node, python, rust, go) and the coding agents are shared tools, mounted read-only from images that every VM shares. They can't update themselves, and global installs go into your home: `npm i -g` installs into `~/.npm-global`, and Python's packages go into a virtual environment or `~/.local/bin`.
- The toolchains, such as node ([the list](https://devvm.dev/docs/using/toolchains/)), and the coding agents are shared tools, mounted read-only from images that every VM shares. They can't update themselves, and global installs go into your home: `npm i -g` installs into `~/.npm-global`, Python's packages go into a virtual environment or `~/.local/bin`, and `dotnet tool install -g` installs into `~/.dotnet/tools`.
- mise runs the shared tools. A project that asks for another version, in `.tool-versions`, `mise.toml` or its own toolchain file, gets it from mise, which installs it in your home on first use.
- `sudo` needs no password, and `apt install` (`apk add` on Alpine) goes through the proxy, whose allowlist for every VM has Ubuntu's, Debian's and Alpine's package hosts. What it installs is lost when the VM is made again.
- `devvm-fetch URL SHA256 OUT` downloads a file and fails when its checksum doesn't match.
+22 -3
View File
@@ -17,6 +17,8 @@
# and DEVVM_LOCAL_PROXY (ADDRESS:PORT on the VM's loopback, where devvm-local-proxy
# listens; empty without a proxy)
# tools the VM's shared tool images, "FILE TOOL VERSION" lines; tools.sh mounts them
# tool-alias.toml the [tool_alias] table of devvm's shared-tools/mise.toml: the backend each
# tool's image was built from, which mise's registry might not give its name
# opencode-import.json the store's opencode logins as opencode auth import reads them, with
# placeholders (none: no opencode login in the store); opencode.sh imports them
# hosts the VM's links (devvm checked them): a line per target, "ADDRESS NAME
@@ -72,12 +74,15 @@ if [[ -n "$DEVVM_LANG" ]] && command -v locale-gen >/dev/null && ! locale -a | g
fi
# Shared tools: mount this VM's images (at boot too, by devvm-tools.service), then tell mise which
# versions to use. /etc/mise is mise's system config: the user's own (~/.config/mise) comes first.
# versions to use, and each one's backend. /etc/mise is mise's system config: the user's own
# (~/.config/mise) comes first.
cmp -s "$s/tools.sh" /usr/local/sbin/devvm-tools 2>/dev/null || sudo install -D -m 755 "$s/tools.sh" /usr/local/sbin/devvm-tools
cmp -s "$s/tools" /etc/devvm/tools 2>/dev/null || sudo install -D -m 644 "$s/tools" /etc/devvm/tools
# A tool it can't mount fails the setup, and devvm names it from /run/devvm/tools-unmounted.
sudo /usr/local/sbin/devvm-tools
{
cat "$s/tool-alias.toml"
echo
echo '[tools]'
while read -r _ tool version; do [[ -z $tool || $tool == rust ]] || echo "$tool = \"$version\""; done < "$s/tools"
cat <<'T'
@@ -87,13 +92,16 @@ experimental = true
shared_install_dirs = ["/opt/devvm/tools"]
# A project's version files choose versions, as their own tools would; a version that isn't shared
# installs into the VM on first use. Not go: go.mod's go line is a minimum, and Go's own GOTOOLCHAIN
# reads its toolchain line.
idiomatic_version_file_enable_tools = ["node", "python", "bun", "pnpm"]
# reads its toolchain line. dotnet's is global.json's sdk.version, which mise installs as it is.
idiomatic_version_file_enable_tools = ["node", "python", "bun", "pnpm", "dotnet"]
auto_install = true
not_found_auto_install = true
python.compile = false
# mise points GOBIN into Go's install, which is read-only: go install goes to ~/go/bin.
go_set_gobin = false
# Each .NET SDK in a folder of its own, the shared one's its image: mise would otherwise run every SDK
# from one folder of the VM's, which the shared one isn't in.
dotnet.isolated = true
# The project folder is the user's own: trust its mise.toml without asking.
trusted_config_paths = ["/"]
T
@@ -119,6 +127,17 @@ go=$(awk '$2 == "go" { print $3 }' "$s/tools")
if [[ -n $go && "$(cat ~/.config/go/telemetry/mode 2>/dev/null)" != off* ]]; then
/opt/devvm/tools/go/"$go"/bin/go telemetry off
fi
# .NET's global tools (~/.dotnet/tools) find the shared runtime in every shell through
# /etc/dotnet/install_location, where .NET's programs look for an installed one: mise sets
# DOTNET_ROOT only in the shells it activates.
dotnet=$(awk '$2 == "dotnet" { print $3 }' "$s/tools")
loc=$(cat /etc/dotnet/install_location 2>/dev/null || true)
if [[ -n $dotnet && $loc != "/opt/devvm/tools/dotnet/$dotnet" ]]; then
sudo mkdir -p /etc/dotnet
echo "/opt/devvm/tools/dotnet/$dotnet" | sudo tee /etc/dotnet/install_location >/dev/null
elif [[ -z $dotnet && $loc == /opt/devvm/tools/* ]]; then
sudo rm -f /etc/dotnet/install_location
fi
# Claude Code checks for itself at ~/.local/bin/claude.
claude=$(awk '$2 == "claude" { print $3 }' "$s/tools")
if [[ -n $claude ]]; then mkdir -p ~/.local/bin; ln -sfn /opt/devvm/tools/claude/"$claude"/claude ~/.local/bin/claude; fi
+30 -17
View File
@@ -4,37 +4,44 @@
set -euxo pipefail
: "${devvm_arch:?}" "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
# Pinned downloads (scripts/bump.sh updates them).
mise_version=2026.10.7
mise_sha256_arm64=c7108d85a32ba17e4747d31d4a42f39f0c134f16211e204e8ef0a49d4f518fe1
mise_sha256_amd64=6eb1b890e90818417ca34c90dbbd47881917d5cd199f31b63b062ea9c6b18d85
mise_sha256_arm64_musl=e036eb7bd3ca63e8565497e597967484330a74ff24e9c4c9f2ac41824cbf4090
mise_sha256_amd64_musl=fc5137a3147494e039c3d5fc3d84de354170d7d8dafdb0b5f0b6f3f19d1dd922
mise_version=2026.11.3
mise_sha256_arm64=a9a2a66bbbe87ea9cc849e1f006606ae2b34f3d3ba56a54d5cd5d64b6557d164
mise_sha256_amd64=c2f7e814cb39f60b7f67a0ff36cb805e94128bf2dff09d175309d0f095b8cc3b
mise_sha256_arm64_musl=78c87fb8c8af031755f9241cbcd1886cd458c75e8f324020015445a776789e38
mise_sha256_amd64_musl=72f1cb4591ee2ba90150022c3ee8aea4dd88fadac10c56d04ede4faffb5a1b03
export DEBIAN_FRONTEND=noninteractive
# Alpine (--from alpine): apk, OpenRC and musl. Its packages come from the release's repositories,
# which have no snapshots: they aren't pinned.
if [[ $devvm_libc == musl ]]; then
# GNU tar: devvm's launch sends files with it (busybox's lacks options it uses). sqlite: an export
# of agents' history copies opencode's database without its logins with it.
# of agents' history copies opencode's database without its logins with it. icu-libs: the dotnet
# shared tool's .NET needs ICU.
sudo apk add --no-cache git curl wget ca-certificates build-base unzip jq ripgrep bash coreutils tar \
util-linux util-linux-misc losetup findmnt erofs-utils sqlite
util-linux util-linux-misc losetup findmnt erofs-utils sqlite icu-libs
echo "devvm: Alpine's packages aren't pinned" >&2
else
# The package lists are apt.sh begin's: base's packages are recorded at its first build and replayed
# from devvm's cache after (layers/apt.sh), and a --from image's come from its own sources, unpinned.
# erofs-utils: the shared tools' builds make their images with it, in a VM cloned from base. sqlite3:
# an export of agents' history copies opencode's database without its logins with it.
sudo apt-get install -y git curl wget ca-certificates build-essential unzip jq ripgrep erofs-utils sqlite3
# an export of agents' history copies opencode's database without its logins with it. ICU: the dotnet
# shared tool's .NET needs it, and its package's name has its version (libicu76), so it's the newest
# libicuN the package lists have (a replay's lists have only the one recorded).
icu=$(apt-cache pkgnames libicu | grep -E '^libicu[0-9]+$' | sort -V | tail -1 || true)
sudo apt-get install -y git curl wget ca-certificates build-essential unzip jq ripgrep erofs-utils sqlite3 ${icu:+"$icu"}
fi
# devvm-fetch URL SHA256 OUT: every layer downloads through this, so an image only ever contains
# files whose checksums are pinned in devvm's scripts.
# files whose checksums are pinned in devvm's scripts. A SHA-512 (128 hex digits) is checked as one:
# the shared tools' build gets the .NET SDK's from the tools lock.
sudo tee /usr/local/bin/devvm-fetch >/dev/null <<'SH'
#!/bin/sh
set -eu
url=$1 want=$2 out=$3
curl -fsSL --retry 3 -o "$out" "$url"
got=$(sha256sum "$out" | cut -d' ' -f1)
sum=sha256sum
[ "${#want}" -ne 128 ] || sum=sha512sum
got=$("$sum" "$out" | cut -d' ' -f1)
if [ "$got" != "$want" ]; then
rm -f "$out"
printf 'devvm-fetch: checksum mismatch for %s\n expected %s\n got %s\n' "$url" "$want" "$got" >&2
@@ -70,7 +77,7 @@ fi
mkdir -p ~/.bashrc.d
grep -qs bashrc.d ~/.bashrc || echo 'for f in ~/.bashrc.d/*.sh; do [ -r "$f" ] && . "$f"; done' >> ~/.bashrc
# mise runs the shared tools (node, python, go, rust, agents), read-only images mounted at
# mise runs the shared tools (node, python, go, rust, dotnet, agents), read-only images mounted at
# /opt/devvm/tools by devvm-tools (guest/tools.sh). Each VM's tools and versions are in
# /etc/mise/config.toml (written by guest/sync.sh); the user's own mise config and a project's version
# files (.nvmrc, .python-version, ...) come first, and versions that aren't shared install into the VM.
@@ -82,15 +89,21 @@ rm /tmp/mise
# Every shell finds the tools: login shells through profile.d, interactive ones through mise activate
# (it follows `cd` into projects with other versions), and the rest (`bash -c` from agents, editors
# over SSH) through BASH_ENV and mise's shims. Read-only installs can't take global packages or update
# themselves: npm installs globals into ~/.npm-global, and Claude Code's and opencode's auto-updates
# are off.
# themselves: npm installs globals into ~/.npm-global, Claude Code's and opencode's auto-updates are
# off, and dotnet tool install -g installs into ~/.dotnet/tools, which is on the PATH, so the SDK
# doesn't add it to a shell's profile on its first run. .NET's telemetry, its first-run banner and
# its background check for workload updates are off.
sudo tee /etc/profile.d/devvm-tools.sh >/dev/null <<'SH'
case ":$PATH:" in *":$HOME/.local/share/mise/shims:"*) ;; *)
export PATH="$HOME/.npm-global/bin:$HOME/go/bin:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH" ;;
export PATH="$HOME/.npm-global/bin:$HOME/go/bin:$HOME/.cargo/bin:$HOME/.dotnet/tools:$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH" ;;
esac
export NPM_CONFIG_PREFIX="$HOME/.npm-global"
export DISABLE_AUTOUPDATER=1
export OPENCODE_DISABLE_AUTOUPDATE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
export DOTNET_ADD_GLOBAL_TOOLS_TO_PATH=false
export DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE=true
SH
grep -qs devvm-tools /etc/environment || echo 'BASH_ENV=/etc/profile.d/devvm-tools.sh' | sudo tee -a /etc/environment >/dev/null
echo 'eval "$(mise activate bash)"' > ~/.bashrc.d/mise.sh
@@ -129,7 +142,8 @@ SH
sudo chmod 755 /usr/local/bin/xdg-open
echo 'export BROWSER=xdg-open' | sudo tee /etc/profile.d/devvm-browser.sh >/dev/null
# Telemetry off for every tool that has a switch (installed by devvm or commonly by projects).
# Telemetry off for every tool that has a switch (installed by devvm or commonly by projects), but
# .NET's, which devvm-tools.sh turns off in every shell.
sudo tee /etc/profile.d/devvm-telemetry.sh >/dev/null <<'SH'
export DO_NOT_TRACK=1 # generic opt-out (bun and others)
export DISABLE_TELEMETRY=1 # Claude Code
@@ -141,7 +155,6 @@ export NUXT_TELEMETRY_DISABLED=1
export GATSBY_TELEMETRY_DISABLED=1
export STORYBOOK_DISABLE_TELEMETRY=1
export YARN_ENABLE_TELEMETRY=0
export DOTNET_CLI_TELEMETRY_OPTOUT=1
SH
# Ubuntu: no news fetched for the login banner or apt output.
sudo sed -i 's/^ENABLED=1/ENABLED=0/' /etc/default/motd-news 2>/dev/null || true
+5 -5
View File
@@ -5,11 +5,11 @@ set -euxo pipefail
: "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
# Pinned downloads (scripts/bump.sh updates them). Docker's repository has no snapshots: its packages
# are pinned by version.
docker_version=29.9.0
containerd_version=2.4.1
buildx_version=0.38.0
compose_version=5.6.0
model_version=1.2.6
docker_version=29.9.3
containerd_version=2.4.2
buildx_version=0.38.1
compose_version=5.7.0
model_version=1.2.9
docker_gpg_sha256=1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570
# Alpine (--from alpine): Docker is Alpine's own package, from the release's repositories, which have
+24 -6
View File
@@ -4,6 +4,7 @@
# (~/.local/share/devvm/mise.lock) in its .build folder. Each tool gets a VM and a folder of its own,
# so nothing one tool's installer does, as root or not, reaches another tool's image.
# build.sh TOOL VERSION FILE
# build.sh dotnet VERSION FILE URL SHA512
# The tool is installed at exactly the locked version (checked against the lock's checksums), then
# packed into one compressed read-only EROFS image, FILE in that folder; devvm moves it into the share
# and records its hash. Project VMs mount it at /opt/devvm/tools/<tool>/<version>, where mise finds it
@@ -14,11 +15,11 @@ set -euxo pipefail
: "${devvm_arch:?}" "${devvm_libc:?}" # devvm's prelude (prelude.sh) comes before this script
# Pinned downloads (scripts/bump.sh updates them). rustup checks the toolchain against Rust's signed
# channel manifest.
rustup_version=1.29.1
rustup_sha256_arm64=15f6e4ce9f583b929c996c91562bad6d4454f3281de858b02cdfdef615fac433
rustup_sha256_amd64=dda7234360b7f578ca8b0ddcb80145646fa61a67c1720a5abc7051b35c9fcb71
rustup_sha256_arm64_musl=1ddf36182ac5d1782dbeefcb9bea7f5f9412d88f4a0d5047b1564a223624e8c6
rustup_sha256_amd64_musl=331228566cc931f32cd684f9bebc5956a5e5d7394c8d5de595f196a658ab98e6
rustup_version=1.29.3
rustup_sha256_arm64=9f608c142e0e38a78957d0661ba1dfaf0b6fb37184cfaa4b9a0aa57af6184282
rustup_sha256_amd64=b1c8cb14e30889e7e2999e6b69e62d9e9b9ffc0f4df8180564d306d9680e6c55
rustup_sha256_arm64_musl=956deacdc27ab82ae7ac821d5d3e9e95e4795d476d17efe99743bb8531ca1031
rustup_sha256_amd64_musl=1552169aba2836777136ccff7a381e95c17233b5d8250cd5e10ae3cb971bfcfc
share=/mnt/devvm-tools
# Where VMs mount the tools: installs record absolute paths (mise's bin links, scripts' shebangs).
@@ -57,7 +58,8 @@ glibc_needs() {
rm -f "$files" "$elf"
}
[[ $devvm_libc != gnu ]] || command -v readelf >/dev/null || { echo "build.sh: base has no readelf (binutils)" >&2; exit 1; }
(( $# == 3 )) || { echo "build.sh: wants TOOL VERSION FILE, got $# arguments" >&2; exit 2; }
(( $# == 3 )) || [[ $# == 5 && $1 == dotnet ]] ||
{ echo "build.sh: wants TOOL VERSION FILE (dotnet: and URL SHA512), got $# arguments" >&2; exit 2; }
tool=$1 version=$2 file=$3
wait_share
@@ -75,6 +77,22 @@ if [[ $tool == rust ]]; then
RUSTUP_HOME=$work/rustup CARGO_HOME=$work/cargo "$dir/rustup-init" -y -q --no-modify-path \
--profile default --default-toolchain "$version" -c rust-src -c rust-analyzer
mv "$work/rustup/toolchains/$version-$triple" "$dir/toolchain"
elif [[ $tool == dotnet ]]; then
# Microsoft's SDK archive, the lock's download for this platform, which devvm passes with the
# SHA-512 the lock records for it: mise's own installer runs Microsoft's install script, which
# checks nothing.
[[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ && $# == 5 ]] || { echo "build.sh: dotnet wants a release's VERSION, URL and SHA512" >&2; exit 2; }
dir=$work/dotnet/$version; mkdir -p "$dir"
devvm-fetch "$4" "$5" /tmp/dotnet-sdk.tar.gz
tar -xzf /tmp/dotnet-sdk.tar.gz -C "$dir"
rm /tmp/dotnet-sdk.tar.gz
sdks=$("$dir/dotnet" --list-sdks)
[[ $sdks == "$version "* ]] || { echo "build.sh: the archive has another SDK than $version: $sdks" >&2; exit 1; }
# Workloads install into the user's ~/.dotnet, which the SDK does when its folder has this marker
# for its feature band (10.0.400 for 10.0.403): the SDK's own folder is read-only in VMs.
band=${version%.*}.$(( ${version##*.} / 100 * 100 ))
mkdir -p "$dir/metadata/workloads/$band"
touch "$dir/metadata/workloads/$band/userlocal"
else
# By name: mise resolves mise.toml's version through the lock (an explicit tool@version isn't
# matched to the lock's entry).
+8
View File
@@ -0,0 +1,8 @@
# dotnet: NuGet's packages and tools, and the revocation lists of DigiCert, which issues NuGet's
# signing certificates, that NuGet checks each package's signatures against; the SDKs mise installs
# for a global.json's version (the install script at dot.net, the SDK's archive). Microsoft's
# telemetry is left out.
api.nuget.org
crl3.digicert.com:80
dot.net
builds.dotnet.microsoft.com
+12
View File
@@ -1,6 +1,17 @@
# The shared tools (the docs' images page, "Shared tools"). devvm resolves each, per user, to upstream's newest
# release matching its version here, into ~/.local/share/devvm/mise.lock with each download's checksum
# per platform. A version here is a hold (node = "24"); nothing is pinned.
# Where each tool that isn't one of mise's own (core:) comes from, named here so that mise's registry
# can't move it to another source: its first choice can change between mise releases (opencode 2
# moved to npm, which has no download per platform). VMs' mise gets the same list.
[tool_alias]
claude = "aqua:anthropics/claude-code"
codex = "aqua:openai/codex"
opencode = "github:anomalyco/opencode" # its GitHub releases: a musl build of its own, attested
pnpm = "aqua:pnpm/pnpm"
uv = "aqua:astral-sh/uv"
[tools]
node = "24" # Node 25+ drops corepack
pnpm = "latest"
@@ -9,6 +20,7 @@ python = "latest"
uv = "latest"
go = "latest"
rust = "latest" # installed with the rustup pinned in build.sh; rustup checks the toolchain
dotnet = "latest" # the SDK; devvm adds its downloads and their SHA-512 from Microsoft's releases
claude = "latest"
codex = "latest"
opencode = "2" # upstream marks its 1.x releases as GitHub's latest, which "latest" resolves to
+1 -1
View File
@@ -57,7 +57,7 @@ Claude Code needs your Claude login before its first start, which `devvm agent l
{{< feature title="Toolchains" icon="code" level="3" art="toolchains" >}}
`devvm` chooses the toolchains your project's files call for, and you can choose more when you customize a new VM or name them with `--tools` ([toolchains](docs/using/toolchains.md)).
`devvm` has toolchains for node, python, rust, go and dotnet. It chooses the ones your project's files call for, and you can choose more when you customize a new VM or name them with `--tools` ([toolchains](docs/using/toolchains.md)).
{{< /feature >}}
+2 -2
View File
@@ -11,13 +11,13 @@ weight: 1
{{< os-tab name="macOS" >}}
- macOS 13 or newer, on arm64 or x86_64.
- Lima 2.0 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
- Lima 2.2 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
{{< /os-tab >}}
{{< os-tab name="Linux" >}}
- Linux on arm64 or x86_64.
- Lima 2.0 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
- Lima 2.2 or newer, with `limactl` on your `PATH`. Install it with Homebrew, `brew install lima`, or see [Lima's install guide](https://lima-vm.io/docs/installation/).
- QEMU from your package manager: `qemu-system-aarch64` (or `qemu-system-x86_64`) and `qemu-img`.
- Read and write access to `/dev/kvm`. That means virtualization is turned on in the firmware (or nested virtualization, in a VM), and your user is in the `kvm` group.
+1 -1
View File
@@ -7,7 +7,7 @@ Add shared tools to this folder's VM, then open a shell in it
## Synopsis
Add shared tools to this folder's VM, then open a shell in it. TOOL is node, python, rust, go, claude, codex or opencode, each a separate word. devvm builds any of them that aren't built, and for a new agent in a running VM it asks before restarting the VM.
Add shared tools to this folder's VM, then open a shell in it. TOOL is a toolchain, such as node, or a coding agent, such as claude, each a separate word. devvm builds any of them that aren't built, and for a new agent in a running VM it asks before restarting the VM.
```text
devvm tools add TOOL... [flags]
+6 -5
View File
@@ -16,10 +16,11 @@ devvm upgrade [flags]
## Examples
```text
devvm upgrade # install the newest release, asking first
devvm upgrade --check # say whether a newer release is out
devvm upgrade --force # install it without asking, as a script must
devvm upgrade --to 0.1.0 # install that release, even an older one
devvm upgrade # install the newest release, asking first
devvm upgrade --check # say whether a newer release is out
devvm upgrade --force # install it without asking, as a script must
devvm upgrade --to 0.1.0 # install that release, even an older one
devvm upgrade --to 0.2.0-rc.1 # install a prerelease, which only --to installs
```
## Options
@@ -29,7 +30,7 @@ devvm upgrade [flags]
-f, --force don't ask to confirm, which devvm needs without a terminal or with --no-input
-h, --help help for upgrade
--json print it as one JSON object, for scripts
--to VERSION install the release VERSION instead of the newest, even one older than this devvm
--to VERSION install the release VERSION instead of the newest, even an older one or a prerelease
```
## Options inherited from parent commands
+5 -5
View File
@@ -61,7 +61,7 @@ Run the tasks with `mise run <task>`:
Before and after every change, `mise run fmt && mise run lint && mise run test` must pass.
CI runs `lint` and `test` on macOS and Linux. A change that touches only the docs and Markdown files skips them: the Docs workflow runs `lint:docs` and builds the site instead, and deploys it on every push to `main`.
CI runs `lint` and `test` on macOS and Linux. A change that touches only the docs and Markdown files skips them: the Docs workflow runs `lint:docs` and builds the site instead, and on every push to `main` it deploys next.devvm.dev ([the docs sites](maintaining.md#the-docs-sites)).
## Go lint rules
@@ -142,7 +142,7 @@ forbidigo matches only the function a call names, so the checks that look at a c
The structure test also finds a copy of an owner's code by its text, in `literals`. A string literal outside tests that holds `'\''`, the escaped quote a shell quoter writes, belongs in `internal/shell`, and one that holds `[0-9a-f]{14}`, the hash at the end of a project VM's name, belongs in `internal/vmname`. A quote written as a rune, such as `'\''` in Go, isn't a string literal, so it doesn't count. In the same way, `separators` finds a copy of a parser by what it splits on: a call to any function of package `strings` with `+` as an argument, as a literal or as a constant, splits or joins an image's layers, so it belongs in `internal/image`. A call with another argument that holds a `+`, such as `strings.ContainsAny(arg, "+,")`, doesn't count.
The shared tools have one owner too, the table `image.SharedTools` in `internal/image/tool.go`. Each entry, an `image.ToolDef`, holds a tool's name, its kind (a toolchain or an agent), its members (the tools in the lock that its name stands for, such as pnpm and bun for node), the files in a project folder that call for it, and its installer, which is mise for every tool but rust, which rustup installs. `image.Toolchains`, `image.Agents`, `image.GroupTools`, the files that make devvm choose a toolchain for a new VM, the lock's check for downloads (`image.NoDownload`) and the `devcontainer.json` features that devvm maps to a toolchain all come from it. To add a shared tool, you add its entry, its members to `assets/shared-tools/mise.toml`, its policy as `assets/shared-tools/<name>.policy`, and a section to its user page, `using/toolchains.md` or `using/coding-agents.md`. The [agreement tests](#agreement-tests) fail until the table and those files match.
The shared tools have one owner too, the table `image.SharedTools` in `internal/image/tool.go`. Each entry, an `image.ToolDef`, holds a tool's name, its kind (a toolchain or an agent), its members (the tools in the lock that its name stands for, such as pnpm and bun for node), the files in a project folder that call for it, and its installer, which is mise for every tool but rust, which rustup installs, and dotnet, which `assets/shared-tools/build.sh` unpacks from Microsoft's SDK archive. mise locks dotnet's version without a download, because its own installer runs Microsoft's install script, which checks nothing, so devvm adds each platform's archive and its SHA-512 from Microsoft's release metadata to the lock (`withSDKDownloads` in `internal/tools/dotnet.go`), and `Share.Build` passes them to build.sh (`image.OwnDownload`), which checks the archive with `devvm-fetch`. `image.Toolchains`, `image.Agents`, `image.GroupTools`, the files that make devvm choose a toolchain for a new VM, the lock's check for downloads (`image.NoDownload`) and the `devcontainer.json` features that devvm maps to a toolchain all come from it. To add a shared tool, you add its entry, its members to `assets/shared-tools/mise.toml`, its policy as `assets/shared-tools/<name>.policy`, and a section to its user page, `using/toolchains.md` or `using/coding-agents.md`. The [agreement tests](#agreement-tests) fail until the table and those files match.
The scripts that devvm's builds run with bash have one owner for the machine they run on, `assets/prelude.sh`, whose `$devvm_arch`, `$devvm_libc` and `devvm_sha` give each script its architecture, its C library and its pinned checksum for each download ([the scripts' prelude](../internals/images.md#the-scripts-prelude)). A script reads them rather than run `uname -m` or look for `apk` itself, and checks that the prelude came first with `: "${devvm_arch:?}"` for each variable it reads, which also tells shellcheck that the variable is set. Go reads each of those scripts through `image.OwnScript`, which puts the prelude before it, so a recipe, a tool image's key and the conversion's copy of `oci/build.sh` all hold the two together. `TestPreludeUsers` in `internal/image` fails when a script that doesn't get the prelude, such as `assets/oci/bootify.sh` or `assets/guest/`'s, uses it, or when a script reads a variable without that check. `testdata/script/prelude.txtar` checks which pin `devvm_sha` picks from each script's pins on arm64 and amd64, with glibc and with musl. A CLI test or a Go test that sources one of these scripts sources `assets/prelude.sh` first.
@@ -379,10 +379,10 @@ The sections so far:
- `images`: building base and fixture layers, rebuilds, a failed script and Ctrl+C during a build, then base's recorded packages, each in the cache under its SHA-256, and base built again under the same key with `ubuntu-mirror` set to an address nothing answers on, whose apt reads only the build's own folder of packages.
- `project`: devvm in a new project folder (under `/tmp/devvm-go-e2e/p`) makes a VM from base and opens a shell there, which reads its commands from devvm's input. The folder and the shared tools are mounted and nothing else is, there's no SSH agent, no Docker (no docker layer) and the hostname is the folder's. The ssh config lists it as `devvm-web` with its host keys pinned; through an `~/.ssh/config` of the run's own that includes it under a `Host *` forwarding the agent, `ssh devvm-web` works, forwards no agent (a throwaway one), and refuses a changed host key. `.git` is locked (macOS) and git in the VM can still commit. `devvm stop` stops it and drops its entry, and on macOS reports and locks a submodule git folder the VM added. `TestE2EExecQuoting` in `internal/backend/registry`, which runs only there (`DEVVM_E2E_VM` names the VM), checks that arguments with spaces, quotes, `$`, newlines and globs, a folder and input reach the guest as given, through the `Exec` of the backend the VM's state records, so one test covers every backend. Then a VM from a `devcontainer.json`, with no ports by default: its `forwardPorts` said and not forwarded, none reaching this machine, its `containerEnv` in the shell and its commands, its `postCreateCommand` run once in the folder, its `postStartCommand` at each start (again after `devvm restart`), nothing written to the folder, and a changed file warned about without changing the VM. Then a claude VM with a fake agent config, history, git identity and token in a home of its own: `devvm agent import` copies the agent's settings into the sandbox's agent store without the history or the links out of its folder, the store's folder is mounted read-only and linked into the VM's home, and the home folder's isn't mounted, its settings are copied and its history isn't, the VM gets the git identity, the timezone and its hostname, and, open as it is, the token's placeholder and never the token. `devvm agent save` without a terminal shows the VM's changed `settings.json` as a diff and its new `commands` folder's file, then refuses and saves nothing, and after a yes it saves both into the store, but neither the VM's fake login beside them nor the folder's link out of it. Then SSH agents, with a home of their own and throwaway keys: a `--ssh-agent` VM uses a throwaway agent standing for yours; after `devvm ssh-agent add` and `devvm ssh-agent devvm` it keeps yours, in its shell and by name, until a restart, then uses only devvm's own agent's key, in its shells and by name; after `devvm ssh-agent off`, none.
- `gc`: a VM from a folder named `img-keep`, which is named like an image, and a fixture layer edited after its build: `devvm gc` deletes the stale image and its record and an old tool image no VM lists (once there's a tools lock), and keeps base and the VM.
- `tools`: first, the shared tools resolve to upstream's newest versions, with devvm's pinned mise (downloaded once), each download with its checksum. This section is the only one that uses the newest versions, and no other step checks for them (`DEVVM_NO_TOOL_CHECK`). At the section's end, e2e puts the pinned lock back. Then a node project's VM: node, npm, pnpm, bun and yarn at the locked versions, each a read-only EROFS image, the share read-only even for root, `npm i -g` into the VM's home, a non-login shell over SSH, an `.nvmrc`'s own version, the tools mounted at boot without devvm, and a second node VM that builds nothing.
- `tools`: first, the shared tools resolve to upstream's newest versions, with devvm's pinned mise (downloaded once), each download with its checksum. This section is the only one that uses the newest versions, and no other step checks for them (`DEVVM_NO_TOOL_CHECK`). At the section's end, e2e puts the pinned lock back. Then a node project's VM: node, npm, pnpm, bun and yarn at the locked versions, each a read-only EROFS image, the share read-only even for root, `npm i -g` into the VM's home, a non-login shell over SSH, an `.nvmrc`'s own version, the tools mounted at boot without devvm, and a second node VM that builds nothing. Last, a .NET project's VM on the allowlist tier, chosen by its solution file: the shared SDK at the locked version from the share, a console project that restores a package from NuGet, builds and runs, `dotnet tool install -g` into `~/.dotnet/tools` with the tool run from a non-login shell, a workload installed into `~/.dotnet`, nothing of it blocked, and a `global.json`'s own SDK installed into the VM.
- `network`: a VM with Claude Code, Codex and opencode and `--network allowlist`, a fake token in devvm's environment and a fake `~/.claude.json` and Codex login in a home of its own, which `devvm agent import` copies into the sandbox's agent store, only yours to read. Its proxy runs and the self-check passed; its password was in no host process's arguments while devvm launched it (`ps`, sampled), and the guest has it; `ssh devvm-net` reaches it; direct connections fail, even as root, to an address and to other ports; an allowed host works and others, or other ports, are blocked; a line in the VM's policy file that reads as a deny but isn't a rule makes the running proxy refuse an allowed host, with no allow command in `devvm network log --blocked`, `devvm network rm` warns of it, and the host works again once it's gone; DNS fails at once; the host's loopback services are out of reach, directly or through the proxy; the proxy refuses requests without the VM's password; the token is nowhere in the VM, which has its own CA and the next one, its own placeholder and logins' copies with placeholders only; the proxy puts the token in for its host (for the VM's own placeholder only), an MCP server's header and Codex's key for theirs, over TLS the VM verifies; a second allowlist VM has CAs of its own, each VM trusts only its own and has no key, each proxy serves and presents only its own VM's CAs, and `devvm rm` deletes one VM's CAs and leaves the other's; the home folder's and the store's login files are unchanged. `devvm agent save` saves the VM's changed `~/.claude.json` with the store's MCP header in place of its placeholder, and once the VM changes that server's URL it leaves the file out, so the store keeps the server as it was. `devvm secret set github --stdin` saves a fake token (in the Keychain on macOS, under the run's service, found through a link to `~/Library/Keychains` in the VM's home), read from a file so it's in no process's arguments, and `devvm secret` lists it saved, while asking `devvm secret` for a `get` subcommand is refused without printing it; `secret use github` binds it to the running proxy at once, and on the next launch the VM has its own placeholder in `GH_TOKEN`, never the token, which the proxy puts in for `api.github.com`; `secret unuse` and `rm` take the binding and the token away. `TestE2ESelfCheck` in `internal/netpolicy` runs the self-check on the VM: it passes, then, once the VM is started outside devvm, it fails and stops the VM. `devvm stop` stops the VM and its proxy at once. `devvm network open` makes its next start direct, its proxy set in the guest and answering, and the open VM holds no real secret either: the token is nowhere in it, its environment and Codex's login hold only its placeholders, its proxy puts the token in over TLS the VM verifies with its own CA, and a request that goes around the proxy carries only the placeholder and gets a 401 from the token's host. Then `devvm network internet` and `devvm network none` change its tier at once, the VM running on. Restarted behind the run's company proxy on this machine's loopback, named in the shell's `HTTPS_PROXY` with a fake password that the check reads from a file, the guest has the proxy and reaches GitHub through it, while devvm's run logs hold the password only as `<password>` and Lima's `ha.stderr.log` only as stars. `devvm network allowlist` while it runs open shows it `unenforced` until `devvm restart` starts it confined; `devvm network open` while it runs confined keeps it on its proxy until it next starts. Behind a company proxy of the run's own that fakes OpenAI's token endpoint with a certificate from the run's CA, a login made in the VM is captured: the store gets the fake tokens and API key, and the VM gets placeholders. Then `devvm agent login codex` runs the real Codex's login in the VM, curl on this machine opens its callback with the state Codex's address names, through the forward of `localhost:1455`, devvm names the account the store saved, the VM's Codex holds only placeholders, and the forward is gone once the login ends, and gone too after an interrupted login. `devvm agent login opencode --device-code` runs the real opencode 2's Codex device code login in the VM, which the fake endpoint answers too, devvm says the store saved the login, and `opencode auth export` in the VM shows only placeholders. A second VM with opencode has `OPENCODE_DISABLE_AUTOUPDATE=1` in its login shell, makes its database and imports a credential of its own, then `devvm agent login opencode --api-key --provider openrouter --stdin` saves a fake key from the first VM, and at the second VM's next launch its opencode has devvm's entry with the key's placeholder, never the key, beside its own credential, and once its database is deleted and made again, the next launch gives it the key's placeholder again. The same company proxy fakes Claude's token endpoint and Anthropic's API, which logs the token each request brings: `cLine truncated
- `nix`: the nix layer. A copy of `assets/layers/nix.sh` as a layer of the run's own, built behind a company proxy of the run's own, reaches Nix's releases through it and leaves no proxy settings for `nix-daemon` (and not the company proxy's password) anywhere on its image's disk. Then a folder with `package.json`, `flake.nix` and `.envrc` gets a VM with node on the nix layer (`--layers nix`) on the allowlist tier: Nix and direnv at their pins, a store that's root's, `sandbox` on with no fallback, `trusted-users` root alone and an untrusted user's `--option substituters` ignored, `nix-daemon` with the VM's own proxy in devvm's drop-in alone, `nix run nixpkgs#hello` from Nix's cache, a build in Nix's sandbox, `sudo nix` and `nix` over ssh, the flake's dev shell (nixpkgs at a pinned revision) loaded by direnv in an interactive shell, its `node` ahead of the shared node prompt after prompt and gone outside the folder, nix-direnv's cache in the VM's home with no `.direnv` in the folder, a fixed-output download from a host that isn't allowed refused with `403` and named by `devvm-why`, and after `devvm network open` and `devvm restart`, no drop-in and no proxy for the daemon.
- `from`: run with a `docker` that isn't running, so nothing comes from Docker. Its container images go by their pinned digests, as `node:24@sha256:…`, so devvm looks them up nowhere, except the company proxy's `alpine:3.21`, which keeps its tag so that devvm's registry lookup is checked too. A VM from `node:24` with node, python and Claude Code on the docker and nix layers (Debian 12, in a home of its own) boots, with its base keyed by the pinned digest, its node, python and claude at the locked versions, GNU `tar` as its commands find it, its tool images built in a clone of devvm's own Ubuntu base when the run builds them, the docker layer's Docker from Docker's Debian repository, and the nix layer's Nix under systemd running `nix run nixpkgs#hello` and a build in Nix's sandbox; a VM from `alpine:3` with node on the docker, nix and desktop layers runs node and pnpm from musl tool images, built in its own base and keyed and recorded by its digest, the docker layer's Docker on OpenRC, the desktop layer's programs from Alpine's packages, with no crashed services, and the nix layer's Nix as an OpenRC service, with `nix run nixpkgs#hello` and a sandboxed build, then after `devvm network allowlist` and `devvm restart` a download only its daemon makes from a host that isn't allowed refused with the proxy's `403`, and with GNU `tar` as its commands find it, `devvm history import` puts an export into it, while an export with a path outside the agents' history imports nothing there; base builds from `ubuntu:26.04`; and the build VM and its temporary folders are gone.
- `from`: run with a `docker` that isn't running, so nothing comes from Docker. Its container images go by their pinned digests, as `node:24@sha256:…`, so devvm looks them up nowhere, except the company proxy's `alpine:3.21`, which keeps its tag so that devvm's registry lookup is checked too. A VM from `node:24` with node, python and Claude Code on the docker and nix layers (Debian 12, in a home of its own) boots, with its base keyed by the pinned digest, its node, python and claude at the locked versions, GNU `tar` as its commands find it, its tool images built in a clone of devvm's own Ubuntu base when the run builds them, the docker layer's Docker from Docker's Debian repository, and the nix layer's Nix under systemd running `nix run nixpkgs#hello` and a build in Nix's sandbox; a VM from `alpine:3` with node and dotnet, which its `package.json` and `global.json` call for, on the docker, nix and desktop layers runs node and pnpm from musl tool images, and dotnet's musl SDK with ICU, which makes and runs a console project, built in its own base and keyed and recorded by its digest, the docker layer's Docker on OpenRC, the desktop layer's programs from Alpine's packages, with no crashed services, and the nix layer's Nix as an OpenRC service, with `nix run nixpkgs#hello` and a sandboxed build, then after `devvm network allowlist` and `devvm restart` a download only its daemon makes from a host that isn't allowed refused with the proxy's `403`, and with GNU `tar` as its commands find it, `devvm history import` puts an export into it, while an export with a path outside the agents' history imports nothing there; base builds from `ubuntu:26.04`; and the build VM and its temporary folders are gone.
- `link`: links between VMs, each check the end-to-end proof of a row of the threat check in [the design note](../internals/design.md#links-between-vms). It runs devvm with a soft limit of 256 open files, macOS's default, as the link sessions it starts get that limit too, and it makes two small open targets, each forwarding no port and running servers on its own `127.0.0.1` (`/var/tmp/e2e-link.pl`, in perl, which every base has), and a client that forwards every port. Each of the three reserves the link checks' ports (`ip_local_reserved_ports`), so Linux never gives one to a connection's own end, where a connection that just ended would hold it for a minute and a later server or `ssh -R` couldn't bind it. `sshd -T` in each VM shows remote forwards allowed on `127.77.*:*` alone, at the address the host asks for, and the client's own Lima rules ignore every port. A port the target doesn't publish is refused by `devvm link add`, and once a port is published, `devvm link add` on the running client reaches it within seconds as `NAME:PORT` and `NAME.devvm.internal:PORT`, by curl and by a raw TCP client (bash's `/dev/tcp`), while with `--as NAME` the target's folder name doesn't resolve. Two targets on one port are each reached by their own name, port 80 is linked on port 80, `devvm link` and `devvm link publish` list what they hold with `"version": 1` in their `--json`, and `devvm network allowlist` is refused for the client while it links to open targets. A published port that isn't linked has nothing listening for it, `devvm link unpublish` refuses the link's next connection, logs it and names the client, and `devvm link rm` takes the listener away within seconds. In the client, sshd listens only on its own port and the links' addresses, and nothing from a link listens on `127.0.0.1`, `::1` or every address, so this machine gets no forward of a link, while a server of the client's own on `127.0.0.1` with a link's port is forwarded as usual. Each link's socket is mode 600 in the run folder of mode 700, and the link session and every process it starts listen on no TCP port and connect only to the VMs' ssh ports. `ssh -R` into the client binds nothing outside `127.77.0.0/16` (`rfwd_links`). A program in the client that holds a link's address first fails that link alone with `link_port_taken`, 256 connections at once, past the socket's backlog of 128 on macOS, are all carried, and a 257th is refused and logged as `link_limit`. Root in the client then loosens its sshd and the link session connects again: with `PermitListen any` the client binds only the links' addresses, because the host asks for nothing else, and with `GatewayPorts yes` too, the link session still listens on no TCP port of this machine and connects only to the VMs' sshd. `devvm network log` shows the links' connections and refusals. A stopped target refuses the connection, logs `link_target_stopped` and stays stopped, and the client's launch warns of it. Once it's restarted, the link works again. `devvm rm` of the target removes the client's link, names the client and removes its sockets, and a VM made again in that folder isn't linked. Then the client and one target get the allowlist tier, the target while it runs. Until the target restarts, `devvm ls` shows it `unenforced`, the client's next connection is refused and logged as `unenforced` while the target's server runs, and `devvm link add` and the client's launch warn of it (`link_target_unenforced`). Once both have restarted, the client reaches its link by curl through its proxy settings and by a raw TCP client while a direct connection fails. A link added while the client runs is reached at once by curl through its proxy, by `GET` and `CONNECT`, with no link name in `NO_PROXY` and the client's boot and host keys unchanged, and the client's proxy refuses names, ports and addresses that aren't on its own list, while the target's proxy refuses the client's link name. `devvm link add` refuses an open target, `devvm network open` is refused for the target, and with the rule broken by hand in the target's state the next connection is refused and the client's launch warns and runs without the link until the rule holds again. In the `--from` tier, an Alpine client reaches its link to port 80. `devvm rm` of the client leaves no link session, socket, pid file, log or link state.
@@ -598,4 +598,4 @@ The tests fail when the checked-in pages are stale: `TestReferenceIsCurrent` in
### Building the site
`mise run docs` serves the site at `http://localhost:1313/` and reloads on every change. `mise exec -- hugo -s docs --minify` builds it into `docs/public/`, as the Pages workflow does on every push to `main`.
`mise run docs` serves the site at `http://localhost:1313/` and reloads on every change. `mise exec -- hugo -s docs --minify` builds it into `docs/public/`, as the Docs workflow does for devvm.dev, and `mise exec -- hugo -s docs --minify --config hugo.yaml,next.yaml` builds the site as next.devvm.dev has it, with its banner and its noindex ([the docs sites](maintaining.md#the-docs-sites)).
+25 -9
View File
@@ -7,12 +7,15 @@ For maintainers: version bumps and releases. Run the scripts with mise, which pu
## Updating pinned versions
- `scripts/bump.sh --check` lists every pin against upstream; `scripts/bump.sh [tool...]` rewrites the pins (all tools by default) and prints a summary for the commit message. It writes a value only if it has the shape of a pin (a version, a 64-hex checksum, a dated release, a commit), since some of the edited files run on the host, and edits nothing unless every value is good. It needs `curl` and `jq`.
- The tools: `docker`, `nix`, `direnv`, `nix-direnv`, `mise`, `rustup`, `crane`, `omb`, `eza`, `tealdeer`, `e2e-tools`, `e2e-from`, `e2e-ubuntu`. base's Ubuntu cloud image and its apt packages have nothing to bump: devvm pins the newest image on each machine at its first build of base, and records the newest packages for each key of base at its first build ([Ubuntu's cloud image](../internals/images.md#ubuntus-cloud-image), [base's packages](../internals/images.md#bases-packages)). `docker` moves Docker's packages (`assets/layers/docker.sh`), read from its repository for base's Ubuntu release, and its signing key. Packages added to `assets/layers/base.sh` or `assets/features/` need no pin of their own: they change base's key, whose first build records them.
- `scripts/bump.sh --check` lists every pin against upstream; `scripts/bump.sh [tool...]` rewrites the pins (all tools by default) and prints a summary for the commit message. It writes a value only if it has the shape of a pin (a version, a 64-hex checksum, a dated release, a commit), since some of the edited files run on the host, and edits nothing unless every value is good. It needs `curl` and `jq`. When upstream's latest is older than a pin, as when a release marker hasn't moved yet, `--check` says the pin is newer and `bump.sh` leaves it as it is.
- Every Monday the Pins workflow (`.github/workflows/pins.yml`) runs `scripts/bump.sh --check` and opens or updates one issue, "Pinned versions to bump", which lists the outdated pins, and closes it once none is left. It never bumps anything: you run `scripts/bump.sh` with the tools it lists, then the `--from` tier of the [end-to-end tests](_index.md#end-to-end-tests), because pin bumps change images.
- The tools: `docker`, `nix`, `direnv`, `nix-direnv`, `mise`, `rustup`, `crane`, `omb`, `eza`, `tealdeer`, `e2e-tools`, `e2e-from`, `e2e-ubuntu`, `e2e-lima`. base's Ubuntu cloud image and its apt packages have nothing to bump: devvm pins the newest image on each machine at its first build of base, and records the newest packages for each key of base at its first build ([Ubuntu's cloud image](../internals/images.md#ubuntus-cloud-image), [base's packages](../internals/images.md#bases-packages)). `docker` moves Docker's packages (`assets/layers/docker.sh`), read from its repository for base's Ubuntu release, and its signing key. Packages added to `assets/layers/base.sh` or `assets/features/` need no pin of their own: they change base's key, whose first build records them.
- `mise` moves base's mise (`assets/layers/base.sh`) and devvm's host mise (`internal/tools/mise.go`) together: the host one writes the lock base's installs from. `TestMisePins` fails when their versions or Linux checksums differ, and base's mise version is in the key of each tool image mise installs, so a bump builds them again.
- The shared tools aren't pinned for users: holds go in `assets/shared-tools/mise.toml` (`node = "24"` stays on that major). `testdata/mise.lock` is a fixed lock for the tests.
- Their backends are named in `mise.toml`'s `[tool_alias]` table, for every tool that isn't one of mise's own `core:` tools, because mise's registry can move a tool to another backend in any release ([versions](../internals/images.md#versions)). A new shared tool gets its alias there, and `TestToolBackendsNamed` fails when a tool that isn't a `core:` tool has none, or when its alias isn't the backend that `tests/e2e-mise.lock` resolved.
- When opencode's major version changes, or a bump of `e2e-tools` moves opencode to a version that adds migrations, refresh `internal/vm/testdata/opencode-<version>.sql`, the schema of opencode's database that `TestOpencodeCleanSchema` cleans. Print it with `sqlite3 ~/.local/share/opencode/opencode.db .schema` in a VM with that opencode, after `opencode auth list` has made the database, and copy only the schema, never rows. Name the file for the version, and in the test put each new table in its list of tables that devvm empties or keeps, which the test asks for. A table or a column that holds a login also goes into `opencodeLogins` (`internal/vm/agents.go`) and the design note's [opencode's database in history exports](../internals/design.md#opencodes-database-in-history-exports).
- `e2e-tools`, `e2e-from` and `e2e-ubuntu` move the end-to-end tests' own pins, which keep their cached images valid between runs: `e2e-tools` resolves `tests/e2e-mise.lock` again, with devvm's pinned host mise, for both architectures' glibc and musl VMs, and refuses a tool whose download has no checksum on every platform yet; `e2e-from` moves the digests of `node:24`, `alpine:3` and `ubuntu:26.04` in `tests/e2e/from_test.go` to Docker Hub's; `e2e-ubuntu` moves `e2eUbuntuRelease` in `tests/e2e/sandbox_test.go`, the dated release of Ubuntu's cloud image that e2e pins base to in place of the newest, to the newest Ubuntu lists. Ubuntu removes dated releases after a few months, and e2e's going stops its first builds of base: bump `e2e-ubuntu` before that. Run `e2e-tools` after any change to `assets/shared-tools/mise.toml`, because the end-to-end tests refuse a lock resolved from another one ([end-to-end tests](_index.md#end-to-end-tests)). `mise run test` catches it first: `TestE2ELockPins` checks the lock's first line against `mise.toml` and that it locks each of its tools, and `TestE2EUbuntuPins` checks that `e2eUbuntuRelease` is a dated release of base's Ubuntu release, which `e2e-ubuntu` lists, and that `scripts/bump.sh` and `tests/e2e` name only that release.
- `e2e-lima` moves the Lima release that CI's end-to-end workflow installs, `LIMA_VERSION` in `.github/workflows/e2e.yml`, to Lima's newest release, and `LIMA_SHA256` to its `Linux-x86_64` tarball's line in that release's `SHA256SUMS`. Lima's release notes print the SHA-256 of `SHA256SUMS` itself, so `e2e-lima` checks the downloaded file against that value first and edits nothing when they differ.
- `assets/layers/ubuntu-cloud.gpg` is Ubuntu's cloud image signing key (fingerprint `D2EB44626FDDC30B513D5BB71A5D6C4C7DB87C81`), from keyserver.ubuntu.com. If Ubuntu changes it, pinning a new image (a first build of base, or `devvm rebuild base`) stops with `ubuntu_bad_signature`: fetch the new key, check its fingerprint against Ubuntu's announcement, and replace the file (`gpg --export FPR`).
- `assets/layers/ubuntu-archive.gpg` is Ubuntu's archive signing key, "Ubuntu Archive Automatic Signing Key (2018)" (fingerprint `F6ECB3762474EDA9D21B7022871920D1991BC93C`), fetched from keyserver.ubuntu.com by that fingerprint, checked against the fingerprint that [Ubuntu's security team lists](https://wiki.ubuntu.com/SecurityTeam/FAQ), and exported with `gpg --export-options export-minimal --export FPR`. devvm checks the `InRelease` files of a first build of base against it (`ubuntu.ArchiveKeyring`). If Ubuntu signs the archive with a new key, that build stops with `packages_refused`: fetch the new key, check its fingerprint the same way, and replace the file. The key must be RSA, because `internal/ubuntu/pgp.go` checks only RSA signatures. Moving base to a new Ubuntu release (`ubuntu.Series`, `ubuntu.Version`) also moves `ubuntu.Released`, the day Ubuntu released it, which is the date of that release's own `InRelease` (`dists/<series>/InRelease`), because devvm refuses a release pocket dated before it.
- Edited scripts change image keys, so the affected images rebuild on next use. An edit to `assets/prelude.sh` changes the key of every image and every shared tool image. Build them in a sandbox of their own (`LIMA_HOME`, `DEVVM_LIMA_HOME`, `XDG_DATA_HOME`, `XDG_CONFIG_HOME`) before committing (`devvm build docker`, or a VM made with the tools whose build script changed), then `devvm gc`, and run the [end-to-end tests](_index.md#end-to-end-tests).
@@ -36,22 +39,35 @@ Until a fix ships, users can still build base, because devvm's fallback to the r
- **Once, the keys:** a minisign key for releases, `minisign -G -p packaging/minisign.pub -s ~/.minisign/devvm.key` (commit `packaging/minisign.pub`; the secret key and its password never go in the repo), and a key git signs tags with (`git config user.signingkey`, GPG, or SSH with `gpg.format ssh`) that `git tag -v` verifies on this machine. Commit its fingerprint in `packaging/release-signer`, one per line (`#` comments): the GPG fingerprint (`gpg --fingerprint`, no spaces), or the SSH key's `SHA256:…` (`ssh-keygen -lf KEY.pub`). `release.sh` refuses a tag signed by any other key, even one git trusts. To rotate, add the new key's line, tag with it, then remove the old one.
- **Each release:** bump `VERSION`, add the `CHANGELOG.md` entry and commit it on `main`. Then tag main's HEAD with `git tag -s v<version>` and run `mise exec -- scripts/publish.sh`, which asks for the minisign password once and asks once more before it publishes anything. The secret key never leaves this machine, and only minisign reads it, so no CI job and no GitHub secret ever has it.
- **Before it builds,** `scripts/publish.sh` checks what it needs and stops with nothing done when a check fails. The tag `v<version>` has to pass `release.sh`'s own checks, so it exists, is signed, and is signed by a key in `packaging/release-signer`. The tag's commit has to be `main`'s HEAD, and `origin`'s `main` has to be an ancestor of it, so that the push is a fast-forward. If `origin` already has the tag, it has to be the same tag. The working tree has to be clean, `gh` has to be installed and logged in (`gh auth status`), and minisign has to be installed. A published GitHub release for the tag is refused unless it already has every file, which is the case when an earlier run stopped after it. The tap's checkout, a clone of `devvmhq/homebrew-tap`, has to exist, be clean and be on `main`: it's `DEVVM_TAP_DIR`, or `../homebrew-tap` next to this repo by default.
- **Then it builds and shows the release.** It runs `scripts/release.sh`, which builds `dist/` and signs `SHA256SUMS`, and where minisign asks for the password. It prints the version, the tag's commit, each file with its size and SHA-256, the release notes, which are the `CHANGELOG.md` entry for the version, and the tap's change as a `git diff` of `Formula/devvm.rb`. It lists the four steps, each marked done or to do. Then it asks `Publish devvm <version>? [y/N]` on the terminal, and any answer but y stops it with nothing published. `--dry-run` stops before the question, so it pushes and publishes nothing and makes no commit in the tap, and `--help` describes the script.
- **A prerelease,** such as a release candidate or a beta, goes out the same way, with a version of the form `x.y.z-<word>.N`: `VERSION` holds `0.2.0-rc.1`, `CHANGELOG.md` gets an entry `## 0.2.0-rc.1`, and the tag is `v0.2.0-rc.1`. The word is lowercase letters, such as `rc`, `beta` or `alpha`, and `release.sh` refuses any other form of `VERSION`. `scripts/publish.sh` marks a prerelease's GitHub release as a prerelease, passing `--prerelease` to `gh release create` and `gh release edit`, so GitHub's latest release skips it, and so do the install script's default, devvm upgrade and the daily release check. It skips the tap altogether, so Homebrew stays on the last release, and it needs no tap checkout. Its printout says the tap is skipped, and it has three steps to do in place of four. At the end, it prints the prerelease's install script line and devvm upgrade `--to` with the version, for checking it.
- **A prerelease's changelog entry** lists what changed since the version before it, whether that's a release or another prerelease, and it becomes that prerelease's notes on GitHub. When the release itself goes out, its entry, such as `## 0.2.0`, replaces its prereleases' entries and lists everything since the last release, so someone who upgrades from that release reads one entry. Each prerelease's notes stay on its GitHub release.
- **Before it builds,** `scripts/publish.sh` checks what it needs and stops with nothing done when a check fails. The tag `v<version>` has to pass `release.sh`'s own checks, so it exists, is signed, and is signed by a key in `packaging/release-signer`. The tag's commit has to be `main`'s HEAD, and `origin`'s `main` has to be an ancestor of it, so that the push is a fast-forward. If `origin` already has the tag, it has to be the same tag. The working tree has to be clean, `gh` has to be installed and logged in (`gh auth status`), and minisign has to be installed. A published GitHub release for the tag is refused unless it already has every file, which is the case when an earlier run stopped after it, and unless GitHub marks it as a prerelease exactly when the version is one. The refusal names the `gh release edit` command that fixes the mark. Except for a prerelease, the tap's checkout, a clone of `devvmhq/homebrew-tap`, has to exist, be clean and be on `main`: it's `DEVVM_TAP_DIR`, or `../homebrew-tap` next to this repo by default.
- **Then it builds and shows the release.** It runs `scripts/release.sh`, which builds `dist/` and signs `SHA256SUMS`, and where minisign asks for the password. It prints the version, the tag's commit, each file with its size and SHA-256, the release notes, which are the `CHANGELOG.md` entry for the version, and the tap's change as a `git diff` of `Formula/devvm.rb`, which a prerelease skips. It lists the four steps, each marked done or to do, and for a prerelease the fourth, the tap, as skipped. Then it asks `Publish devvm <version>? [y/N]` on the terminal, and any answer but y stops it with nothing published. `--dry-run` stops before the question, so it pushes and publishes nothing and makes no commit in the tap, and `--help` describes the script.
- **Then it publishes, in this order.** It pushes `main` and then the tag to `origin`. It makes the GitHub release `devvmhq/devvm` `v<version>` with `gh release create --verify-tag`, titled `devvm <version>`, with the release notes and the archives, the source tarball, `SHA256SUMS`, `SHA256SUMS.minisig` and `install.sh`. The release starts as a draft and is published only once every file is uploaded, so nobody sees a release that is missing files. Last, it copies `dist/devvm.rb` to the tap's `Formula/devvm.rb`, commits it as `devvm <version>` with the tap's own commit signing, and pushes the tap. It uses `gh` for GitHub and never puts a GitHub token on a command line. At the end it prints how to check the release: `brew update && brew upgrade devvm`, or `brew trust --formula devvmhq/tap/devvm` and then `brew install devvmhq/tap/devvm`, and the install script's `curl` line.
- **When a step fails,** it says which steps it published and which it didn't. Fix what failed and run it again, because every step skips what's already done: a pushed `main` or tag, a published release whose `SHA256SUMS` matches the new build's, and a tap already at the version. A draft release that an earlier run left gets this build's files again before it's published. A release published from another build, whose `SHA256SUMS` doesn't match, is refused. To finish by hand instead, run the steps it didn't do in order: `git push origin main`, `git push origin v<version>`, the `gh release create` above (or `gh release upload --clobber` to a draft, then `gh release edit v<version> --draft=false`), and then copy `dist/devvm.rb` to the tap, commit it and push it.
- **When a step fails,** it says which steps it published and which it didn't. Fix what failed and run it again, because every step skips what's already done: a pushed `main` or tag, a published release whose `SHA256SUMS` matches the new build's, and a tap already at the version, or any tap for a prerelease. A draft release that an earlier run left gets this build's files again before it's published. A release published from another build, whose `SHA256SUMS` doesn't match, is refused. To finish by hand instead, run the steps it didn't do in order: `git push origin main`, `git push origin v<version>`, the `gh release create` above (or `gh release upload --clobber` to a draft, then `gh release edit v<version> --draft=false`), each with `--prerelease` for a prerelease, and then, except for a prerelease, copy `dist/devvm.rb` to the tap, commit it and push it.
- `scripts/release.sh` checks the tag with `git tag -v` and its signer against this checkout's `packaging/release-signer`, then builds `dist/` from the tagged commit with GoReleaser (`.goreleaser.yaml`), in a clone of its own, so only what's committed goes in, with one `goreleaser release --skip=publish`. It checks that the binary built for this host prints the version, writes `install.sh` and adds its checksum to `SHA256SUMS`, then signs `SHA256SUMS` with `~/.minisign/devvm.key` (or `DEVVM_MINISIGN_KEY`) and verifies it with `packaging/minisign.pub`. Nothing is published, because publishing is `scripts/publish.sh`'s. `scripts/release.sh --check` runs only the tag's checks and the build's preconditions, prints the tag's commit and builds nothing, and `scripts/publish.sh` runs it first.
- `dist/` then holds:
| File | What |
| --- | --- |
| `devvm-<version>-<os>-<arch>.tar.gz` | the binary, its files (`assets/`) embedded, with `README.md`, `CHANGELOG.md` and `LICENSE`, for `darwin` and `linux`, `arm64` and `amd64` |
| `devvm-<version>.tar.gz` | the source, which the Homebrew formula builds from |
| `devvm-<version>.tar.gz` | the source, attached to the release for whoever wants to build devvm themselves |
| `SHA256SUMS`, `SHA256SUMS.minisig` | their checksums and `install.sh`'s, and the signature |
| `install.sh` | the install script, set to this release and to `packaging/minisign.pub`'s key |
| `devvm.rb` | the Homebrew formula, set to the source tarball's URL and checksum |
| `devvm.rb` | the Homebrew formula, set to each platform's archive, its URL and its checksum from `SHA256SUMS` |
- `scripts/release.sh --head` builds from HEAD's commit instead, for testing, with `VERSION`'s version. It's unsigned unless `DEVVM_MINISIGN_KEY` names a test key; `DEVVM_MINISIGN_PUB` names its public key in place of `packaging/minisign.pub`. `DEVVM_RELEASE_URL` points the formula at a test location. A commit without `install.sh` is refused.
- `scripts/release.sh --head` builds from HEAD's commit instead, for testing, with `VERSION`'s version, a release's or a prerelease's. It's unsigned unless `DEVVM_MINISIGN_KEY` names a test key; `DEVVM_MINISIGN_PUB` names its public key in place of `packaging/minisign.pub`. `DEVVM_RELEASE_URL` points the formula at a test location. A commit without `install.sh` is refused.
- `scripts/release.sh --formula-from DIR` writes only `dist/devvm.rb`, for `VERSION`'s release once it's published, and builds nothing. Download the release's `SHA256SUMS` and `SHA256SUMS.minisig` into `DIR` first. The script checks the signature against `packaging/minisign.pub`, then fills in the formula the same way a build does, from that `SHA256SUMS`.
- To try `dist/install.sh` on such a build, copy `dist/` to `DIR/releases/download/v<version>/`, then in a throwaway `HOME` with `DEVVM_PREFIX` under it: `DEVVM_INSTALL_TEST=1 source dist/install.sh`, set `repo_url=file://DIR` and `protos='=https,file'` (it downloads over HTTPS only), and run `main --no-deps`. Without `--no-deps` it offers to install what the host lacks: answer no, or run it with no terminal.
- Every build sets the version with `-X github.com/devvmhq/devvm/internal/cli.version=<version>`: devvm doesn't read `VERSION`. The formula (`packaging/homebrew/devvm.rb`) builds with Go the same way, installs the binary alone, and passes `brew audit --strict`.
- Every build sets the version with `-X github.com/devvmhq/devvm/internal/cli.version=<version>`: devvm doesn't read `VERSION`. The formula (`packaging/homebrew/devvm.rb`) builds nothing. It has an archive for each of macOS and Linux on arm64 and Intel, the same archives the install script installs, and it installs the binary alone from the one for this machine. `release.sh` fills in each archive's URL and its checksum, which it reads from the `SHA256SUMS` it just wrote, on every line that isn't a comment. The generated formula passes `brew audit --strict --online` and `brew style`.
- Publishing is the maintainer's call, so an agent asks first and never runs `scripts/publish.sh` without `--dry-run` on its own. The script's tests (`testdata/script/publish.txtar`) run it against a local bare repo as `origin`, a local bare tap and a fake `gh`.
## The docs sites
The docs have two sites, and the Docs workflow (`.github/workflows/docs.yml`) deploys both. devvm.dev shows the docs of the latest release, so what users read matches the devvm they install. next.devvm.dev shows the docs on `main`, for the next release, which is what someone trying a prerelease reads. A pull request that touches the docs gets their lints and a build, and it deploys nothing, so a pull request from a fork never reaches either site or its keys.
- **devvm.dev** is GitHub Pages, in the repo's `github-pages` environment, which accepts deployments from `main` and from `v*` tags, and only admins can create a `v*` tag. When a release is published, and it isn't a prerelease, the workflow builds the docs in that release's tag and deploys them. A release event runs the workflow file that the tag has, so a release whose tag predates this workflow doesn't deploy on its own. Pushes to `main` never change devvm.dev.
- **To deploy a release's docs by hand,** for a release that didn't deploy on its own or to put devvm.dev back on a release, run the Docs workflow from `main` in the repo's Actions tab, or with `gh workflow run docs.yml --repo devvmhq/devvm -f site=devvm.dev -f ref=v0.1.0`. The site is `devvm.dev` unless you choose another one, and the ref is the release's tag, which has to look like `v0.1.0`, so a prerelease's tag is refused. Without a ref, the workflow deploys the latest release, as `gh release view` names it.
- **next.devvm.dev** is Cloudflare Pages, serving the files on the `main` branch of the repo `devvmhq/docs-next`, and Cloudflare builds nothing. On each push to `main` that touches the docs, the workflow lints and builds `main`'s docs for next.devvm.dev, then replaces everything in `devvmhq/docs-next` but its `README.md` with the build, and commits it as `Build from devvm <short sha>`. When the build is the same as the last one, it commits nothing. `gh workflow run docs.yml --repo devvmhq/devvm -f site=next.devvm.dev` runs it by hand. Nobody edits `devvmhq/docs-next` by hand, because the next build replaces it.
- **The deploy key** that pushes to `devvmhq/docs-next` is the secret `DOCS_NEXT_DEPLOY_KEY` in the `docs-next` environment, which only `main` can deploy from. It's an ed25519 key with write access to `devvmhq/docs-next` and to nothing else. The workflow checks that repo out with it only after the site is built, so the build never sees the key. To rotate it, make a new key, add its public half to `devvmhq/docs-next` as a deploy key with write access, put its private half in the secret, then delete the old deploy key.
- **The next build** is `hugo -s docs --minify --config hugo.yaml,next.yaml`, which reads `docs/next.yaml` over `docs/hugo.yaml`. It sets the site's address to `https://next.devvm.dev/` and puts a banner on every page that says these docs are for the next devvm and links to devvm.dev. It also sets `noindex`, so Hextra gives every page a `noindex, nofollow` robots meta tag, and `docs/layouts/robots.txt` disallows everything, so search engines don't index the site. devvm.dev's build, `hugo -s docs --minify`, never reads `docs/next.yaml`, so it has no banner, its pages say `index, follow`, and its `robots.txt` allows everything.
+1 -1
View File
@@ -113,7 +113,7 @@ A new VM gets what the project's `devcontainer.json` says, as far as devvm does
- **Reading:** only in the folder, through `os.Root` (a link out of it isn't followed, `..` included), opened without blocking (a FIFO the VM made in its place opens at once and is refused) and checked as a regular file on the open descriptor, at most 1 MiB. It's read once, at `plan`; what the VM is made from is the parsed plan, recorded in its state, never the file read again. Later launches only hash it and warn.
- **Parsing:** comments and trailing commas are blanked at the same offsets, strings untouched, then `encoding/json`; values of the wrong kind, a NUL, an environment variable's name that isn't one, and every variable devvm doesn't fill in are refused before anything's made, `${localEnv:…}`/`${env:…}` above all. Nothing is filled in from this machine: `${containerWorkspaceFolder}` is the folder's path (the same in the VM), `${containerEnv:X}` the VM's own `X`, left to its shell.
- **Mapped, or refused, or ignored:** `build`/Dockerfiles/Compose are refused; `initializeCommand` never runs; `mounts`, `runArgs`, `privileged`, `capAdd`, `securityOpt`, `workspaceMount` and the rest are ignored, named. Features map only to devvm's own layers (docker-in-docker to the docker layer, four toolchains); no feature's script is fetched, `docker-outside-of-docker` is refused, everything else too.
- **Mapped, or refused, or ignored:** `build`/Dockerfiles/Compose are refused; `initializeCommand` never runs; `mounts`, `runArgs`, `privileged`, `capAdd`, `securityOpt`, `workspaceMount` and the rest are ignored, named. Features map only to devvm's own layers (docker-in-docker to the docker layer, five toolchains); no feature's script is fetched, `docker-outside-of-docker` is refused, everything else too.
- **The image:** `--from`'s path, but only an image its registry gives anyone: asked anonymously (`from.Lookup.Public`, never Docker's store), pinned to that digest, which the build pulls by. A registry named `localhost` or by an address that isn't the internet's is refused by name, and the lookup's client (`from.NewPublicRegistry`) connects only to the internet's addresses, whatever a name resolves to, its token service's included; offline, only a registry digest recorded for that reference stands in.
- **The docker layer:** the backend's own rules for it, as when it's named; the file never changes the VM's tier.
- **The environment:** each variable's value is built as a shell word (single-quoted text, `"${X}"` for the VM's own), stored as JSON in the VM's state, and written as `export NAME=word` into the VM's environment file before devvm's own (which win); a name is checked again when it's written.
+11 -1
View File
@@ -176,6 +176,8 @@ When the registry doesn't give devvm the image ([images only Docker has](../usin
devvm doesn't pin the shared tools' versions ([shared tools](../using/images.md#shared-tools)). Instead, `assets/shared-tools/mise.toml` says which releases to follow, which is the latest of each tool, and Node 24. The first time a tool is needed, devvm resolves it to upstream's newest release and writes that into the tools lock, `~/.local/share/devvm/mise.lock`, with each download's checksum for every platform that VMs run (Linux, with glibc and with musl). Builds install exactly the lock's versions and check them against those checksums. Resolving needs this machine to be online once, and until it has been, devvm says so (`tools_need_resolve`).
mise's registry decides where a tool comes from, and a mise release can change its choice, so `assets/shared-tools/mise.toml` names the backend of every tool that isn't one of mise's own `core:` tools in its `[tool_alias]` table. Claude Code, Codex, pnpm and uv come from their GitHub releases through [aqua](https://aquaproj.github.io/), and opencode comes from its GitHub releases directly (`github:anomalyco/opencode`), because only that gives musl VMs opencode's own musl build. Without the alias, mise's registry would take opencode 2 from npm, which has no download for each platform. The step back locks the older versions from the backend that the newest came from, and every project VM's mise config gets the same `[tool_alias]` table, so the VM's mise finds each tool where its image came from.
The resolving runs on this machine with a mise of devvm's own. That mise is a pinned release, which devvm downloads once into `~/.local/share/devvm/cache/mise/<version>` and checks against its SHA-256 before it runs it (`mise_checksum`). A download that gets no answer, loses it partway or gets a 408, 429 or server error is tried again up to three times, after one second and then twice as long each time, and any other answer fails it at once (`mise_download_failed`). devvm never uses the mise you have installed, and nothing it does reaches your own mise config. Each run of that mise gets temporary folders for its data, cache, state and config, which devvm deletes afterwards, so `cache/mise/<version>` holds only the binary. `devvm gc` deletes the folders of other versions (`Versions.StaleMise`), unless one changed in the last hour.
Sometimes a tool's newest version isn't published for every platform yet, for example when a release is still uploading, when a tag has no release, or for a few days after a Node release until its musl builds appear. A version counts as published only where its lock entry has a download with a checksum, since mise checks the download against it. devvm then takes the newest of the next five older versions that is published everywhere, and says so (`tool_stepped_back`). When none of them is, devvm says that too (`tool_no_download`). The next check tries the newest version again.
@@ -193,10 +195,18 @@ Before a build, devvm reads the record of the base it's about to clone and refus
A glibc build also measures the newest glibc version that each tool needs, because each upstream download is built against a glibc of its own and doesn't run on an older one. After installing the tool, the build script reads the version needs of every ELF program and library in it with `readelf`, which base's `build-essential` installs, and writes the newest `GLIBC_` version they name into `<image>.glibc`, or nothing when none needs one. It leaves out folders named `testdata`, because Go's has ELF files from other systems that nothing runs. devvm takes that file only as a plain file holding one version (`tool_bad_output`) and keeps the version in the image's record (`glibc`). Before it gives a VM its tools, devvm compares each image's version with the glibc of the VM's `--from` base, and an older base refuses the tool, naming it and both versions (`tool_needs_glibc`). It checks the same way when `devvm tools add`, `devvm tools update` or `devvm update` gives an existing VM tools, against the glibc its state recorded when it was made. A base from Ubuntu's cloud image has no glibc version in its record, so its tools aren't checked, and a musl base gets musl builds, which need no glibc. Only one build at a time writes to the share, because each holds the share's lock, `~/.local/share/devvm/tools.lock`, outside the share that VMs mount. Another devvm waits for it, saying so (`share_waiting`) after 3 seconds, until the build ends or you press Ctrl+C. The lock is an OS lock on an open file, so the system releases it when its devvm ends, however it ends, and a devvm that crashed or that you killed never leaves another one waiting.
Each tool image is named `<tool>-<version>-<key>.erofs`. Its key hashes the tool's entry in the tools lock (its version, its downloads and their checksums), `assets/shared-tools/build.sh` with [the prelude](#the-scripts-prelude) before it, the `[settings]` table of `assets/shared-tools/mise.toml`, the version of mise that `assets/layers/base.sh` pins, the C library the image is built for, the base it builds in (devvm's own for glibc, and for musl the digest of the `--from` base), and the backend's format. The build VM is made from base, so base's mise is the one that installs the tool, and a new mise builds every tool image it installs again. Rust is the exception, because rustup installs it, so mise's version isn't in its key. The tests check that `base.sh` pins the same mise as the one devvm runs on the host, with the same Linux checksums. devvm reads the lock as TOML and hashes what the tool's entry says, the entry of the version the image installs, so a mise that writes the same lock in another order, with other spacing or quoting, leaves every key as it is. The settings are in the key because they change what mise installs, such as `python.compile`, and the key reads what they say in the same way, so a comment or another way of writing the same settings leaves it as it is. Lima's format is `build.sh`'s own, compressed EROFS, which adds nothing to the key. A new version, a new download, an edited build script or a changed setting builds the image again, and a base with a different C library, such as Alpine's musl, gets an image of its own, and so would a VM on another backend. Every glibc image's key names devvm's own base, because glibc images build only there, so a VM on Ubuntu's base and one on a `--from` Debian image share them. A musl image's key has its base's digest, so when the container image's tag moves to a new image, its VMs' next tools build again in the new base. When the lock has no download of a tool for the VM's platform, devvm doesn't build it and says to try again later (`tool_unbuilt`).
Each tool image is named `<tool>-<version>-<key>.erofs`. Its key hashes the tool's entry in the tools lock (its version, its downloads and their checksums), `assets/shared-tools/build.sh` with [the prelude](#the-scripts-prelude) before it, the `[settings]` table of `assets/shared-tools/mise.toml`, the version of mise that `assets/layers/base.sh` pins, the C library the image is built for, the base it builds in (devvm's own for glibc, and for musl the digest of the `--from` base), and the backend's format. The build VM is made from base, so base's mise is the one that installs the tool, and a new mise builds every tool image it installs again. A tool that `build.sh` installs itself, without mise, doesn't have mise's version in its key, because mise doesn't install it: rustup installs rust, and dotnet comes from Microsoft's own archive ([dotnet's download](#dotnets-download)). The tests check that `base.sh` pins the same mise as the one devvm runs on the host, with the same Linux checksums. devvm reads the lock as TOML and hashes what the tool's entry says, the entry of the version the image installs, so a mise that writes the same lock in another order, with other spacing or quoting, leaves every key as it is. The settings are in the key because they change what mise installs, such as `python.compile`, and the key reads what they say in the same way, so a comment or another way of writing the same settings leaves it as it is. Lima's format is `build.sh`'s own, compressed EROFS, which adds nothing to the key. A new version, a new download, an edited build script or a changed setting builds the image again, and a base with a different C library, such as Alpine's musl, gets an image of its own, and so would a VM on another backend. Every glibc image's key names devvm's own base, because glibc images build only there, so a VM on Ubuntu's base and one on a `--from` Debian image share them. A musl image's key has its base's digest, so when the container image's tag moves to a new image, its VMs' next tools build again in the new base. When the lock has no download of a tool for the VM's platform, devvm doesn't build it and says to try again later (`tool_unbuilt`).
An image is base and its layers alone, and a VM's shared tools are a list in its state (the `tools` section's `names`) beside its image. `build.Names` refuses a shared tool's name in an image name (`tool_not_layer`), so `devvm build`, `devvm rebuild` and `devvm images rm` refuse one, because shared tools aren't images and their versions come from the lock.
### dotnet's download
mise resolves dotnet's version like any tool's, but it locks the version alone, without a download, because its installer runs Microsoft's install script, which nothing pins. So devvm adds each platform's SDK archive to the lock itself (`withSDKDownloads` in `internal/tools/dotnet.go`). For each dotnet entry that lacks a platform's download, it fetches the channel's list of releases, `https://builds.dotnet.microsoft.com/dotnet/release-metadata/<channel>/releases.json`, over HTTPS and capped at 32 MB, and it records that platform's `dotnet-sdk-<rid>.tar.gz` with its SHA-512. It keeps a file only when its URL is under `https://builds.dotnet.microsoft.com/dotnet/` and its hash is 128 hex digits, and a version that Microsoft doesn't list gets no download, so devvm doesn't build it. The image's key hashes that lock entry, its URLs and checksums included, as it does every tool's.
`build.sh` gets the URL and the SHA-512 from devvm and downloads the archive with `devvm-fetch`, which checks a 128-character checksum as a SHA-512 and any other as a SHA-256, and which deletes the file and fails when the sum differs. The script unpacks the archive and checks that `dotnet --list-sdks` names the locked version. The SDK's folder is read-only in VMs, so the script puts a `userlocal` marker in its `metadata/workloads/<band>` folder, for its feature band (10.0.400 for 10.0.403), which makes `dotnet workload install` install into `~/.dotnet` in the VM. In the VM, `sync.sh` writes the shared SDK's folder into `/etc/dotnet/install_location`, where .NET's programs look for an installed runtime, so global tools find it in every shell and not only those that mise activates, and it sets mise's `dotnet.isolated`, which gives each SDK a folder of its own, so the shared one runs from its image.
The trust root is Microsoft's `releases.json`, read over HTTPS, which is the same model as the upstream checksums that mise locks for the other tools. An SDK that a project's `global.json` asks for is different: mise installs it in the VM with Microsoft's install script, which checks only HTTPS and the download's size, and it stays in that VM's home, so no image or other VM gets it.
## A company's CA in builds
Build VMs trust the CA certificates in `~/.config/devvm/ca` ([a company's CA](../using/settings.md#a-companys-ca)) while they build, and images never keep them. [Network tiers](network.md#a-companys-ca) describes how devvm reads them and how `assets/guest/ca.sh` installs them.
+6 -5
View File
@@ -7,7 +7,7 @@ This page explains what devvm's install script downloads and checks, what `devvm
## The install script
The script installs the release it comes with, or the one that `--version` names. Before it downloads anything, it checks whether Homebrew installed devvm, which it does when `brew` is on `PATH`. The check never runs `brew`, because Homebrew can download its own Ruby when it runs. Instead, the script looks for a version folder in `Cellar/devvm` in each place Homebrew keeps its Cellar: the folder next to the `brew` it found on `PATH` (`<brew's folder>/../Cellar`), `HOMEBREW_CELLAR` and `HOMEBREW_PREFIX/Cellar` when they're set, and the Cellar in `/opt/homebrew`, `/usr/local` and `/home/linuxbrew/.linuxbrew`. When Homebrew has devvm, the script stops with an error that says to run `brew upgrade devvm`, or `brew uninstall devvm` first, and exits with status 1, in a terminal or without one. `--force` skips this check. Then it installs in four steps:
The script installs the release it comes with, or the one that `--version` names, which may be a prerelease, such as `0.2.0-rc.1`. Without either, it installs the latest release, never a prerelease. Before it downloads anything, it checks whether Homebrew installed devvm, which it does when `brew` is on `PATH`. The check never runs `brew`, because Homebrew can download its own Ruby when it runs. Instead, the script looks for a version folder in `Cellar/devvm` in each place Homebrew keeps its Cellar: the folder next to the `brew` it found on `PATH` (`<brew's folder>/../Cellar`), `HOMEBREW_CELLAR` and `HOMEBREW_PREFIX/Cellar` when they're set, and the Cellar in `/opt/homebrew`, `/usr/local` and `/home/linuxbrew/.linuxbrew`. When Homebrew has devvm, the script stops with an error that says to run `brew upgrade devvm`, or `brew uninstall devvm` first, and exits with status 1, in a terminal or without one. `--force` skips this check. Then it installs in four steps:
1. It downloads the archive for this machine and the release's `SHA256SUMS`, over HTTPS only. The archive is `devvm-<version>-<os>-<arch>.tar.gz`, where the OS is `darwin` or `linux` and the processor is `arm64` or `amd64`. On Apple silicon, the script picks `arm64` even when it runs under Rosetta.
2. It checks the signature of `SHA256SUMS`, then the archive's checksum, as [the signature](#the-signature-and-what-it-trusts) describes. When either check fails, it installs nothing.
@@ -20,16 +20,15 @@ At the end, when `~/.local/bin` is on `PATH`, the script looks up which devvm `P
## The signature and what it trusts
`curl … | bash` trusts everything in the release, and Homebrew checks the source against a checksum kept outside it:
`curl … | bash` trusts everything in the release, and Homebrew checks the same archive against a checksum kept outside it. Both install the release's own binary, the one `SHA256SUMS` lists and its signature covers, and Homebrew installs only the binary from it:
```mermaid
flowchart TD
subgraph release["the GitHub release"]
script["install.sh, with<br>the public key"] -- "checks the signature" --> sums["SHA256SUMS,<br>signed in .minisig"]
sums -- "checks the checksum" --> archive["the archive<br>for this machine"]
source["the source archive"]
end
formula["Homebrew's formula,<br>in a repository of its own"] -- "checks its checksum" --> source
formula["Homebrew's formula,<br>in a repository of its own"] -- "checks its checksum" --> archive
```
The release's `SHA256SUMS` lists the checksums of its archives and of its `install.sh`, and it's signed in `SHA256SUMS.minisig`, made with the maintainer's minisign key. The key's public half is in the script and in `packaging/minisign.pub`. Without [minisign](https://jedisct1.github.io/minisign/) (`brew install minisign`), the script says so, prints the command to check the signature by hand, and checks only the checksum. A script that isn't from a release has no key, and it also checks only the checksum.
@@ -137,6 +136,8 @@ When the script installs a new version, it removes the older versions in `~/.loc
`devvm upgrade` installs a release in Go, with the same files and checks as the install script, and it never runs the script. It reads the newest release's version from where GitHub's `releases/latest` redirects, `releases/tag/v<version>`, as the script does, so it needs no API and has no rate limit. Every request goes over HTTPS, and a redirect to anything else is refused.
GitHub's `releases/latest` skips the releases marked as prereleases, which are the versions with a suffix, such as `0.2.0-rc.1`. devvm upgrade, the daily release check and the install script also refuse a prerelease there, so none of them installs or announces one as the newest release, and a prerelease is installed only when `--to` or the script's `--version` names it. A record of the daily check that names a prerelease counts as no record, and the next check replaces it. Versions compare as semver orders them: the numbers as numbers, a prerelease before its release, and a prerelease's suffix part by part, a number below a word and numbers as numbers, so `0.2.0-rc.9` comes before `0.2.0-rc.10`.
### How it tells how devvm was installed
It follows the links of the running binary's path, and it reads only that path, never running anything:
@@ -155,7 +156,7 @@ The archive is unpacked into `<prefix>/lib/devvm/.<version>.new.<pid>`, beside t
### Rollbacks
A server, or someone in the way of one, can offer an older release that's still properly signed. devvm upgrade refuses a newest release older than the running devvm, whatever the flags, and installs an older one only when `--to` names it, after a question that says it's older. It can't tell a server that keeps offering the release you already have from one with nothing newer, which is a limit of reading the newest release from the server.
A server, or someone in the way of one, can offer an older release that's still properly signed. devvm upgrade refuses a newest release older than the running devvm, whatever the flags, and installs an older one only when `--to` names it, after a question that says it's older. When the running devvm is a prerelease, an older newest release is what's expected before the prerelease's own release is out, so devvm upgrade says so and installs nothing, without failing. It can't tell a server that keeps offering the release you already have from one with nothing newer, which is a limit of reading the newest release from the server.
### Switching the link
+5 -3
View File
@@ -169,15 +169,17 @@ VMs with the [nix layer](images.md#the-nix-layer) share their downloads from Nix
## A company's CA
The CA certificates in `~/.config/devvm/ca` ([a company's CA](../using/settings.md#a-companys-ca)) reach every project VM, whatever its tier, and the VM's proxy. Builds trust them too, as [Images and caching](images.md#a-companys-ca-in-builds) describes.
The CA certificates in `~/.config/devvm/ca` ([a company's CA](../using/settings.md#a-companys-ca)) reach every project VM, whatever its tier, and the VM's proxy. Builds trust them too, as [Images and caching](images.md#a-companys-ca-in-builds) describes, and so does the mise that resolves the shared tools' versions on this machine, which on macOS trusts them for every connection but its Sigstore client's, as the host's mise below explains.
**Reading them.** `trust.Read` reads the folder's `*.pem` and `*.crt` files at each launch, each build and each proxy start, and nothing outside the folder. It checks the folder and each of those files with `os.Lstat` and follows no link: a folder that is a link fails with `ca_folder_link`, and a file that is one, dangling or not, with `ca_link`. A link into a project folder would otherwise let that project's VM write the CA that every VM, build and proxy trusts. A file or folder that it can't read fails with `ca_unreadable` or `ca_folder_unreadable`, which name it and carry the error. It decodes every PEM block and refuses a block that isn't `CERTIFICATE` (`ca_not_certificate`), a certificate that `crypto/x509` can't parse (`ca_invalid`) and a certificate without CA basic constraints (`ca_not_ca`). It also refuses a file with no certificate in it. It tells a private key apart by its PEM type, not by the file's name, and a refusal fails the whole launch or build. What leaves the host is each certificate encoded again from its parsed bytes, once each, so the text around a block never does.
**Reading them.** `trust.Read` reads the folder's `*.pem` and `*.crt` files at each launch, each build, each proxy start and each run of the host's mise, and nothing outside the folder. It checks the folder and each of those files with `os.Lstat` and follows no link: a folder that is a link fails with `ca_folder_link`, and a file that is one, dangling or not, with `ca_link`. A link into a project folder would otherwise let that project's VM write the CA that every VM, build and proxy trusts. A file or folder that it can't read fails with `ca_unreadable` or `ca_folder_unreadable`, which name it and carry the error. It decodes every PEM block and refuses a block that isn't `CERTIFICATE` (`ca_not_certificate`), a certificate that `crypto/x509` can't parse (`ca_invalid`) and a certificate without CA basic constraints (`ca_not_ca`). It also refuses a file with no certificate in it. It tells a private key apart by its PEM type, not by the file's name, and a refusal fails the whole launch or build. What leaves the host is each certificate encoded again from its parsed bytes, once each, so the text around a block never does.
**Installing them.** `assets/guest/ca.sh DIR` runs as root and makes devvm's CAs in `/usr/local/share/ca-certificates` exactly DIR's `devvm-*.crt` files: the VM's own CA and its next one, `devvm-proxy.crt` and `devvm-proxy-next.crt`, and the user's `devvm-extra-N.crt`. When anything changed, it runs `update-ca-certificates --fresh`, so a CA that went leaves neither the bundle nor its hashed link. `update-ca-certificates` tells the hooks in `/etc/ca-certificates/update.d` only about the CAs it links, never about a file that was deleted, so `ca.sh` tells them itself. It runs each hook that `run-parts` would run, with a `-/etc/ssl/certs/NAME.pem` line on its input for each CA it removed, as Debian's `update-ca-certificates` does for a CA it deselects. That way Java's `cacerts` (ca-certificates-java's `jks-keystore` hook) and Mono's store drop a removed CA, in a project VM and in an image whose layer installed Java. A hook that rebuilds its store from the bundle ignores that input. A hook that fails stops nothing, and `ca.sh` says so in the run log. It also writes them all to `/etc/ssl/devvm.pem`, for Node. In a system without `update-ca-certificates`, such as a container image before its `ca-certificates` package, it adds them to `/etc/ssl/certs/ca-certificates.crt` itself. It keeps the bundle as it was in `/var/lib/devvm-ca`, or a mark that there was none, and puts it back once they go, and a package that arrives in between makes the bundle again from the same folder. Run without DIR, `ca.sh` removes every one of devvm's files. Its unit tests run it in a folder that stands for `/` (`DEVVM_CA_ROOT`).
**Project VMs.** The setup that devvm sends at each launch carries `ca.sh` and the certificates in `ca/`, and `sync.sh` runs it, so a change applies at the next launch and a running VM needs no restart. Every project VM starts with `trust.Env` in its environment, whatever its tier and whether there are CAs or not, so adding a CA changes nothing that its backend sets at a start. On Lima, the clone that makes the VM sets the environment too (`VMSpec.Env`), and the VM's first start adds its proxy's address to it in the one edit before its first boot. The variables are `NODE_EXTRA_CA_CERTS=/etc/ssl/devvm.pem`, which is empty when there are none (Node warns only about a missing file), `SSL_CERT_FILE`, `REQUESTS_CA_BUNDLE` and `PIP_CERT`, set to the system's bundle, and `UV_SYSTEM_CERTS=1`.
**The proxy.** `netpolicy.Proxy.Prepare` reads the folder too, and writes the bundle into the proxy's config, `proxy.json` in the VM's run folder, as `upstream_cas`, which the proxy adds to the system's roots for its own TLS connections. Each secret lookup's context carries those roots (`proxy.WithRoots`), and an agent's OAuth refresh on the host trusts them (`proxy.RootsOf`, set on its client with `fetch.Client.Trust`), so it goes through a company proxy that inspects TLS as the VM's own requests do. devvm's other host requests, such as registry digests, Ubuntu's image check and shared-tool downloads, use the host's own store, as the host's other programs do. A VM can't change that file or the folder, so the proxy's roots grow only by what you put there. A proxy whose bundle differs from the folder's starts again, as one whose CA was replaced does.
**The proxy.** `netpolicy.Proxy.Prepare` reads the folder too, and writes the bundle into the proxy's config, `proxy.json` in the VM's run folder, as `upstream_cas`, which the proxy adds to the system's roots for its own TLS connections. Each secret lookup's context carries those roots (`proxy.WithRoots`), and an agent's OAuth refresh on the host trusts them (`proxy.RootsOf`, set on its client with `fetch.Client.Trust`), so it goes through a company proxy that inspects TLS as the VM's own requests do. devvm's other host requests, such as registry digests and Ubuntu's image check, use the host's own store, as the host's other programs do. A VM can't change that file or the folder, so the proxy's roots grow only by what you put there. A proxy whose bundle differs from the folder's starts again, as one whose CA was replaced does.
**The host's mise.** The client that downloads devvm's own mise adds the folder's CAs to the system's roots (`fetch.Client.Trust`), and a download whose server's certificate it still doesn't trust fails with `tools_untrusted`, in place of `mise_download_failed`. That mise, a release build, uses rustls with the platform's verifier, so it trusts the system's roots, and it falls back to Mozilla's own only when none load. On Linux it reads the system's roots from files, as OpenSSL does. When the environment sets neither `SSL_CERT_FILE` nor `SSL_CERT_DIR`, it reads the first bundle it finds, such as `/etc/ssl/certs/ca-certificates.crt`, and the folders `/etc/ssl/certs` and `/etc/pki/tls/certs`, and otherwise it reads only what they name. On macOS it asks Security.framework, which trusts what the Keychain trusts and reads no variable. With CAs in the folder, each run of mise gets them in its temporary folder, and `MISE_EXTRA_CA_CERTS` names them, which mise adds to its roots on both systems. mise's Sigstore client, which fetches the trust root (`tuf-repo-cdn.sigstore.dev`) that its lock-time provenance checks need, ignores that setting, so on Linux `trust.CAs.Host` also writes a bundle of the system's bundle and the folder's CAs, and `SSL_CERT_FILE` names it, which every client in mise reads. The system's bundle is the file that `SSL_CERT_FILE` names when devvm's environment sets it. When devvm's environment sets neither variable, `SSL_CERT_DIR` names the system's folders, so mise still reads them. Otherwise mise reads the folders that devvm's environment names, and none when it sets only `SSL_CERT_FILE`, so a bundle of your own keeps mise to the CAs that you chose and the folder's. On macOS nothing but the Keychain reaches that client, so a CA that a proxy signs that host with has to be trusted there. Each run of mise also logs to a file in its folder (`MISE_LOG_FILE`). When a failed resolve's log has rustls's `invalid peer certificate`, devvm fails with `tools_untrusted`, which names the folder, in place of `tools_resolve_failed` or `tools_need_resolve`.
**End-to-end checks** (`tests/e2e`): in `project`, a VM trusts a test CA from its next launch (`openssl verify` against the system's bundle, and curl reaching an HTTPS server on the host that the CA signed), has the variables, fails its launch on a file that isn't a certificate, and trusts the CA no more once the folder is emptied; in `tools`, Node fetches from that server.
+1 -1
View File
@@ -6,7 +6,7 @@ weight: 20
These pages cover what you change as you work, such as the images VMs are made from, their ports and size, your coding agents, and the editors you connect with.
- [Coding agents](coding-agents.md): the supported agents, which are Claude Code, Codex and opencode, the config they get in a VM, their logins, and their history.
- [Toolchains](toolchains.md): node, python, rust and go, with what each brings, the files that choose it, its version files, its global installs and its allowlist.
- [Toolchains](toolchains.md): the list of toolchains, with what each brings, the files that choose it, its version files, its global installs and its allowlist.
- [SSH and editors](ssh.md): reaching VMs by name from ssh and VS Code, and forwarding your SSH agent.
- [Ports and size](ports-size.md): the ports a VM forwards to your machine, and its CPUs, memory and disk.
- [Managing VMs](vms.md): restarting, stopping, deleting and listing VMs, and what devvm does in a subfolder or when a project folder is made again, moved, deleted or on a disk that isn't connected.
+1 -1
View File
@@ -60,7 +60,7 @@ When the file is gone, devvm makes the VM again without it, so what the file gav
| Property | What devvm does |
| --- | --- |
| `image` | The VM's base starts from it, as with [`--from`](from.md). devvm uses only an image that its registry gives anyone who asks anonymously, pinned to that digest. It never uses an image only Docker has, one only your registry login reaches, or one on this machine or its network, which is `localhost` or a registry whose address is loopback, private or link-local, by name or as it resolves. |
| `features` | `ghcr.io/devcontainers/features/docker-in-docker` is devvm's [docker layer](images.md#built-in-layers). `node`, `python`, `rust` and `go` under `ghcr.io/devcontainers/features/` are the [shared toolchains](images.md#shared-tools). devvm ignores their options and says so in one line. It refuses `docker-outside-of-docker`, which is this machine's Docker, and every other feature. devvm never fetches or runs a feature's script. |
| `features` | `ghcr.io/devcontainers/features/docker-in-docker` is devvm's [docker layer](images.md#built-in-layers). A feature under `ghcr.io/devcontainers/features/` named after one of devvm's [toolchains](toolchains.md), such as `ghcr.io/devcontainers/features/node`, is that shared toolchain. devvm ignores their options and says so in one line. It refuses `docker-outside-of-docker`, which is this machine's Docker, and every other feature. devvm never fetches or runs a feature's script. |
| `forwardPorts` | devvm forwards numbers, `localhost:N` and `127.0.0.1:N` to this machine's `localhost` alone, adding them to your ports as `devvm ports add` does ([ports](ports-size.md#ports)). With every port forwarded, which is the default, they're among them already. `devvm ports rm` takes one out, as for any port. It ignores other hosts' ports and says so in one line. |
| `containerEnv`, `remoteEnv` | The VM's environment, which login shells and the commands below get. `remoteEnv` wins over `containerEnv`, and devvm's own variables, such as `LANG` and secrets, win over both. A `remoteEnv` of `null` sets nothing. |
| `onCreateCommand`, `updateContentCommand`, `postCreateCommand` | They run once, in that order, once the VM is made and set up ([commands](#commands)). |
+1 -1
View File
@@ -41,7 +41,7 @@ If the image's tag moves to another image while devvm builds, for example becaus
- **Alpine** uses OpenRC and musl, so its VMs get musl builds of the shared tools, built on that image and kept apart for it. Its base also gets GNU `tar` from Alpine's packages in place of busybox's, because devvm sends the VM's setup and [imports agents' history](coding-agents.md#importing-history) with it.
- **Unpinned packages.** While `base` builds, its packages come from the container image's own sources as they are then, apt's or Alpine's, and so do the [desktop layer](images.md#desktop)'s, the [docker layer](images.md#docker)'s on Alpine and the [nix layer](images.md#nix)'s. devvm keeps no copy of them, unlike base from Ubuntu's image, so building the same base again installs the sources' packages of that day, and it needs the network for them.
- **A glibc new enough for your shared tools.** A Debian or Ubuntu image's glibc must be at least as new as each shared tool needs, which [shared tools and glibc](#shared-tools-and-glibc) covers.
- **Tested.** The end-to-end tests make VMs from `node:24` (Debian 12, with node, python, claude and the docker and nix layers) and `alpine:3` (with node and the docker, nix and desktop layers), and build `base` from `ubuntu:26.04`.
- **Tested.** The end-to-end tests make VMs from `node:24` (Debian 12, with node, python, claude and the docker and nix layers) and `alpine:3` (with node, dotnet and the docker, nix and desktop layers), and build `base` from `ubuntu:26.04`.
## Shared tools and glibc
+4 -4
View File
@@ -103,12 +103,12 @@ The VM keeps what [a VM made again keeps](#what-a-vm-made-again-keeps), its home
## Shared tools
The toolchains and coding agents are shared tools, not image layers. A VM of any image can have them, in any mix, such as node, python and Claude Code on base, or go and Codex on `foo`. A VM's state lists its shared tools apart from its image. [Toolchains](toolchains.md) lists node, python, rust and go, with what each brings, and [supported agents](coding-agents.md#supported-agents) lists claude, codex and opencode.
The toolchains and coding agents are shared tools, not image layers. A VM of any image can have them, in any mix, such as node and Claude Code on base, or go and Codex on `foo`. A VM's state lists its shared tools apart from its image. [Toolchains](toolchains.md) lists the toolchains, with what each brings, and [supported agents](coding-agents.md#supported-agents) lists claude, codex and opencode.
devvm builds each tool version once and mounts it read-only into every VM that has it, so any mix of tools works without building anything new, and ten VMs with node share one copy of it. The builds are in `~/.local/share/devvm/tools`. Each C library gets a build of its own, so when an Alpine VM and an Ubuntu VM both have node 24, `devvm images` lists two builds of that version ([what devvm keeps](space.md#shared-tools)). An Alpine VM's builds are only ever shared with VMs on the same container image, as [shared tools and glibc](from.md#shared-tools-and-glibc) explains. [mise](https://mise.jdx.dev) runs the tools:
- **They work as usual.** `node`, `npm i -g` (into `~/.npm-global`), `pnpm`, `yarn`, `pip` and `uv`, `go install` (into `~/go/bin`) and `cargo` work from any shell, including `bash -c` from agents and from editors over SSH.
- **A project's own version files win.** `.nvmrc`, `.node-version`, `.python-version`, `rust-toolchain.toml` and the `toolchain` line in `go.mod` pick their version, which installs into the VM the first time it's used. mise also reads a `mise.toml` in the project folder, and devvm trusts it without asking, because the folder is yours.
- **They work as usual.** Each toolchain's commands, such as `npm i -g` (into `~/.npm-global`) or `go install` (into `~/go/bin`), work from any shell, including `bash -c` from agents and from editors over SSH. Global installs go into your home, as [each toolchain's section](toolchains.md) says.
- **A project's own version files win.** `.nvmrc`, `.node-version`, `.python-version`, `rust-toolchain.toml`, the `toolchain` line in `go.mod` and the SDK version in `global.json` pick their version, which installs into the VM the first time it's used. mise also reads a `mise.toml` in the project folder, and devvm trusts it without asking, because the folder is yours.
- **They're read-only.** A VM can't change the shared tools, even as root. The tools can't update themselves, and `rustup component add` can't change the shared toolchain.
- **They're mounted, or the launch stops.** When one of a VM's tools is missing or the VM can't mount it, devvm stops the launch and names the tool, and the VM never downloads its own copy in its place ([a shared tool doesn't mount](troubleshooting.md#a-shared-tool-doesnt-mount)). Only the versions that a project's own version files pick install into the VM.
@@ -244,7 +244,7 @@ The second table lists the [shared tools](#shared-tools) that devvm has built, b
| Column | |
| --- | --- |
| `NAME` | `node`, `python`, `rust`, `go`, `claude`, `codex` or `opencode` |
| `NAME` | a [toolchain](toolchains.md)'s name, such as `node`, or an agent's, such as `claude` |
| `TOOL`, `VERSION` | the tool and its version |
| `LIBC` | the C library (`gnu`, or `musl` for an Alpine base) that this build is for, because each gets a build of its own, or `-` when devvm can't tell |
| `SIZE` | the disk it takes |
+3 -3
View File
@@ -84,7 +84,7 @@ A mirror can't give base a package that Ubuntu didn't publish. apt checks every
When you run devvm in a terminal, it checks at most once a day for a newer devvm release, and when one is out it says so in one line before it opens the VM, naming the release, the version you have and devvm upgrade. devvm never installs anything on its own, so you upgrade with [devvm upgrade](upgrading.md#upgrading) when you choose to. `release-check = false` turns the check off, and so does setting `DEVVM_NO_RELEASE_CHECK=1` in the environment, as CI can. `release-check` must be `true` or `false`, and devvm refuses anything else (`config.toml` names the line). No command saves it, so it's only ever in `config.toml`.
The check reads only where GitHub's latest devvm release is, over HTTPS, and sends nothing about you or your machine. It runs beside the launch, so it never makes devvm wait, and when you're offline it says nothing and tries again the next day. The line comes from what the last check found, so a release that came out since then shows up at the launch after the next check. devvm keeps what the check found in `~/.local/share/devvm/cache/release.json`, and `devvm doctor` shows it. devvm says nothing without a terminal, with `--no-input`, for a devvm built from its source, or for a copy that neither the install script nor Homebrew installed, which devvm upgrade can't upgrade.
The check reads only where GitHub's latest devvm release is, over HTTPS, and sends nothing about you or your machine. The latest release is never a prerelease, so the check never announces one ([trying a prerelease](upgrading.md#trying-a-prerelease)). It runs beside the launch, so it never makes devvm wait, and when you're offline it says nothing and tries again the next day. The line comes from what the last check found, so a release that came out since then shows up at the launch after the next check. devvm keeps what the check found in `~/.local/share/devvm/cache/release.json`, and `devvm doctor` shows it. devvm says nothing without a terminal, with `--no-input`, for a devvm built from its source, or for a copy that neither the install script nor Homebrew installed, which devvm upgrade can't upgrade.
### Where a default comes from
@@ -209,9 +209,9 @@ mkdir -p ~/.config/devvm/ca
cp company-root.pem ~/.config/devvm/ca/
```
devvm reads every `*.pem` and `*.crt` file in that folder each time you open a VM and each time it builds an image, and it leaves other files alone. A file can hold one certificate or several, in PEM, the text form that starts with `-----BEGIN CERTIFICATE-----`. devvm accepts only CA certificates. When a file holds anything else, such as a private key, a certificate devvm can't read or a certificate that isn't a CA's, devvm refuses the whole folder and names the file. It sends only the certificates it read out of a file, never the rest of the file. devvm doesn't follow links there, so copy each certificate into the folder rather than linking to it. When a `*.pem` or `*.crt` file is a link, or the folder itself is one, devvm refuses the whole folder and names the link, because a link into a project folder would let that project's VM replace the CA that every VM, build and proxy trusts. devvm also refuses the folder, naming the file, when it can't read a file there or the folder itself.
devvm reads every `*.pem` and `*.crt` file in that folder each time you open a VM, each time it builds an image and each time it resolves the shared tools' versions, and it leaves other files alone. A file can hold one certificate or several, in PEM, the text form that starts with `-----BEGIN CERTIFICATE-----`. devvm accepts only CA certificates. When a file holds anything else, such as a private key, a certificate devvm can't read or a certificate that isn't a CA's, devvm refuses the whole folder and names the file. It sends only the certificates it read out of a file, never the rest of the file. devvm doesn't follow links there, so copy each certificate into the folder rather than linking to it. When a `*.pem` or `*.crt` file is a link, or the folder itself is one, devvm refuses the whole folder and names the link, because a link into a project folder would let that project's VM replace the CA that every VM, build and proxy trusts. devvm also refuses the folder, naming the file, when it can't read a file there or the folder itself.
Every project VM trusts these CAs in its system's store from its next launch, and so does every VM that devvm builds an image or shared tools in. devvm takes them out of a build VM before the image is finished, so images never keep them, and adding or removing a CA rebuilds nothing. A layer script of yours that copies the system's CA bundle somewhere else does keep that copy. On every [network tier](../safety/network.md), the VM's proxy also trusts them for the connections it makes itself, and so does the refresh of a coding agent's login that the proxy makes on this machine when the login is due, so a company proxy that inspects TLS doesn't make the refresh fail. devvm's other connections from this machine, such as checking an image's registry or Ubuntu's image and fetching shared tools, trust this machine's own store, as your other programs here do. When you take a certificate out of the folder, VMs stop trusting it at their next launch, and stores that copy the system's CAs, such as Java's `cacerts`, drop it too.
Every project VM trusts these CAs in its system's store from its next launch, and so does every VM that devvm builds an image or shared tools in. devvm takes them out of a build VM before the image is finished, so images never keep them, and adding or removing a CA rebuilds nothing. A layer script of yours that copies the system's CA bundle somewhere else does keep that copy. On every [network tier](../safety/network.md), the VM's proxy also trusts them for the connections it makes itself, and so does the refresh of a coding agent's login that the proxy makes on this machine when the login is due, so a company proxy that inspects TLS doesn't make the refresh fail. devvm also resolves the shared tools' versions on this machine, with a mise of its own that it downloads once, and that download trusts these CAs as well as this machine's own store, and on Linux so does that mise. On macOS, mise trusts them for most of its connections, but the part of it that checks where each tool's release was built trusts only the CAs that macOS trusts, which Keychain Access shows. So on macOS, a company's CA that mise needs has to be there too, where a Mac that your company manages usually has it already. When mise doesn't trust a server's certificate, devvm says so and names this folder. devvm's other connections from this machine, such as checking an image's registry or Ubuntu's image, trust this machine's own store, as your other programs here do. When you take a certificate out of the folder, VMs stop trusting it at their next launch, and stores that copy the system's CAs, such as Java's `cacerts`, drop it too.
Most tools read the system's store, among them apt, apk, curl, git and Python's `ssl` module. For those that don't, every VM's environment points them at it:
+23 -3
View File
@@ -3,7 +3,17 @@ title: Toolchains
weight: 2
---
devvm has four toolchains: node, python, rust and go. A new VM gets the ones its folder's files call for, which the summary of the new VM shows, unless you customize the VM and check others in the list or give others with `--tools`, as in `devvm --tools node,python` ([what a new VM gets](images.md#what-a-new-vm-gets)). Each section below says what the toolchain brings and which files make devvm choose it. A project that gets its toolchain from Nix uses the `nix` layer, which [Nix projects](#nix-projects) covers.
devvm has these toolchains:
| Toolchain | What it brings |
| --- | --- |
| [node](#node) | Node 24, with npm, pnpm, yarn and bun |
| [python](#python) | CPython, with pip and uv |
| [rust](#rust) | rustup, cargo and the stable toolchain |
| [go](#go) | Go |
| [dotnet](#dotnet) | the .NET SDK and its runtimes |
A new VM gets the ones its folder's files call for, which the summary of the new VM shows, unless you customize the VM and check others in the list or give others with `--tools`, as in `devvm --tools node,python` ([what a new VM gets](images.md#what-a-new-vm-gets)). Each section below says what the toolchain brings and which files make devvm choose it. A project that gets its toolchain from Nix uses the `nix` layer, which [Nix projects](#nix-projects) covers.
## node
@@ -41,6 +51,15 @@ go brings the newest Go release, and devvm turns Go's telemetry off in the VM.
- **Global installs.** `go install` installs into `~/go/bin` in the VM, which is on the `PATH`.
- **Allowlist.** On the allowlist tier, the VM can reach Go's module proxy, its checksum database and Go's downloads, which are `proxy.golang.org`, `sum.golang.org`, `go.dev` and `dl.google.com`.
## dotnet
dotnet brings the newest release of the .NET SDK, with the .NET and ASP.NET Core runtimes that come with it, and devvm turns off .NET's telemetry and its first-run banner in the VM.
- **Files.** devvm chooses dotnet for a folder with a solution (`*.sln` or `*.slnx`), a C# or F# project (`*.csproj` or `*.fsproj`) or `global.json` at its top level.
- **Versions.** The `sdk.version` in a project's `global.json` picks its SDK, which installs into the VM the first time it's used. mise installs exactly that version and doesn't follow `rollForward`, so a `global.json` that allows a newer SDK still gets the one it names, and a `global.json` without an SDK version keeps the shared one. mise installs that SDK with Microsoft's install script, which checks only the download's size, while devvm checks the shared SDK against the SHA-512 that Microsoft publishes for it.
- **Global installs.** `dotnet tool install -g` installs into `~/.dotnet/tools` in the VM, which is on the `PATH`, and NuGet keeps its packages in `~/.nuget/packages`. The shared SDK is read-only, so `dotnet workload install` installs workloads into `~/.dotnet` in the VM instead of the SDK's folder.
- **Allowlist.** On the allowlist tier, the VM can reach NuGet, the revocation lists that NuGet checks packages' signatures against, and the SDK downloads that a `global.json` asks for, which are `api.nuget.org`, `crl3.digicert.com` on port 80, `dot.net` and `builds.dotnet.microsoft.com`. Microsoft's telemetry isn't on the allowlist.
## Nix projects
A project whose toolchain comes from Nix gets the [`nix` layer](images.md#nix), which brings Nix, direnv and nix-direnv into its VM. For a folder with `flake.nix`, `shell.nix` or `devenv.nix` at its top level, or with a `default.nix` that makes a shell with `mkShell`, the list devvm shows when you customize a new VM names that file in the `nix` row, and you choose it there. A layer isn't chosen by default, so a VM made as its summary shows, or without a terminal, gets it only with `--layers nix`, as in `devvm --layers nix` in a folder with `package.json` and `flake.nix`, which gives node on the `nix` layer.
@@ -89,13 +108,13 @@ What this doesn't cover:
## How toolchains are shared and updated
The toolchains are [shared tools](images.md#shared-tools), like the [coding agents](coding-agents.md#supported-agents), so they aren't part of any image. devvm builds each version once and mounts it read-only into every VM that has it, and [mise](https://mise.jdx.dev) runs it, so `node`, `python`, `cargo` and `go` work from any shell in the VM, including `bash -c` from agents and from editors over SSH. Because the shared copy is read-only, a toolchain can't update itself, and anything you install globally goes into your home in the VM, as each section above says.
The toolchains are [shared tools](images.md#shared-tools), like the [coding agents](coding-agents.md#supported-agents), so they aren't part of any image. devvm builds each version once and mounts it read-only into every VM that has it, and [mise](https://mise.jdx.dev) runs it, so `node`, `python`, `cargo`, `go` and `dotnet` work from any shell in the VM, including `bash -c` from agents and from editors over SSH. Because the shared copy is read-only, a toolchain can't update itself, and anything you install globally goes into your home in the VM, as each section above says.
devvm follows each toolchain's newest release, and Node 24 for node. [Which bases they run on](#which-bases-they-run-on) says what each one needs from a VM's base. [Adding and removing tools](#adding-and-removing-tools) explains how `devvm update` and `devvm tools update` move a VM to newer versions, how `devvm tools add` adds a toolchain to an existing VM, and how `devvm tools rm` takes one out. [What a new VM gets](images.md#what-a-new-vm-gets) explains what happens when a folder calls for more than one toolchain.
## Which bases they run on
Every toolchain runs on `base` from Ubuntu's own image, and on an Alpine-based image with [`--from`](from.md), which gets musl builds of the tools. On a Debian- or Ubuntu-based image, each tool needs at least the glibc version that its prebuilt release was built against. devvm measures that version from the tool's files whenever it builds a new version, and it refuses a tool whose version is newer than the image's glibc ([shared tools and glibc](from.md#shared-tools-and-glibc)). Today the shared tools need these glibc versions, so Debian 10 and Ubuntu 20.04 and newer images run all of them:
Every toolchain runs on `base` from Ubuntu's own image, and on an Alpine-based image with [`--from`](from.md), which gets musl builds of the tools. dotnet also needs ICU, the Unicode library that .NET's globalization uses, so devvm installs ICU in `base`, whether it's made from Ubuntu's image or `--from` a container image. On a Debian- or Ubuntu-based image, each tool needs at least the glibc version that its prebuilt release was built against. devvm measures that version from the tool's files whenever it builds a new version, and it refuses a tool whose version is newer than the image's glibc ([shared tools and glibc](from.md#shared-tools-and-glibc)). Today the shared tools need these glibc versions, so Debian 10 and Ubuntu 20.04 and newer images run all of them:
| Shared tool | arm64 | amd64 |
| --- | --- | --- |
@@ -105,6 +124,7 @@ Every toolchain runs on `base` from Ubuntu's own image, and on an Alpine-based i
| uv, with python | 2.28 | 2.17 |
| rust, with rustup | 2.17 | 2.17 |
| go | none, because its programs need no glibc | none |
| dotnet | 2.27 | 2.27 |
| claude and opencode | 2.17 | 2.17 |
| codex | 2.28, for its voice helper | 2.28 |
@@ -161,6 +161,8 @@ Builds behind a company proxy go through a proxy of devvm's, which allows any ho
When apt, `npm install`, `pip install`, `git clone` over HTTPS or an image's build fails with an error such as `certificate verify failed`, `self-signed certificate in certificate chain` or `unable to get local issuer certificate`, the network you're on may inspect TLS. Ask your IT team for the CA's certificate, or export it from this machine's store, such as Keychain Access on macOS. Put it in `~/.config/devvm/ca` and open the VM again ([a company's CA](settings.md#a-companys-ca)).
When resolving the shared tools' versions fails because this machine doesn't trust a server's certificate, mise's lines in the run log end with `invalid peer certificate: UnknownIssuer`. On Linux, put the CA in `~/.config/devvm/ca`, or add it to this machine's own store, as `update-ca-certificates` does on Debian and Ubuntu, and run devvm again. A bundle that `SSL_CERT_FILE` names in devvm's environment works too, because that mise reads it in place of the system's. On macOS, open the CA's certificate in Keychain Access and set it to be trusted, because the part of that mise that checks where each tool's release was built trusts only what macOS trusts.
`devvm doctor` says so when `HTTPS_PROXY` or `config.toml`'s `proxy.https` is set and the folder has no CA certificates. Many proxies don't inspect TLS, so that line isn't a problem in itself. When devvm refuses a file in the folder, it names the file, and you take out anything that isn't a CA certificate, such as a private key or a server's certificate.
## A listed port isn't forwarded
+26 -6
View File
@@ -10,10 +10,11 @@ This page covers upgrading devvm, switching between Homebrew and the install scr
To upgrade devvm, run `devvm upgrade`, which installs the newest release the way you installed devvm:
```sh
devvm upgrade # install the newest release, asking first
devvm upgrade --check # say whether a newer release is out, and install nothing
devvm upgrade --force # install it without asking, as a script must
devvm upgrade --to 0.1.0 # install that release, even one older than the devvm you have
devvm upgrade # install the newest release, asking first
devvm upgrade --check # say whether a newer release is out, and install nothing
devvm upgrade --force # install it without asking, as a script must
devvm upgrade --to 0.1.0 # install that release, even one older than the devvm you have
devvm upgrade --to 0.2.0-rc.1 # install a prerelease, which only --to installs
```
It says which release it will install in place of the devvm you have, and asks first, so without a terminal or with `--no-input` it needs `--force`.
@@ -70,16 +71,35 @@ When a check fails, devvm upgrade installs nothing, and the devvm you have stays
### An older release
When the newest release is older than the devvm you have, devvm upgrade refuses to install it, even with `--force`. A server that offers an old release in place of the newest could bring back problems that a newer release fixed, so devvm upgrade never goes back a version unless you name it. `devvm upgrade --to VERSION` installs the release you name, newer or older, and it asks first, saying when the release is older than the devvm you have.
When the newest release is older than the devvm you have, devvm upgrade refuses to install it, even with `--force`. A server that offers an old release in place of the newest could bring back problems that a newer release fixed, so devvm upgrade never goes back a version unless you name it. `devvm upgrade --to VERSION` installs the release you name, newer or older, and it asks first, saying when the release is older than the devvm you have. When the devvm you have is a prerelease of a release that isn't out yet, the newest release is older too, and devvm upgrade says so and installs nothing, without failing ([trying a prerelease](#trying-a-prerelease)).
Homebrew installs only its formula's release, so with Homebrew devvm upgrade doesn't take `--to`.
### Trying a prerelease
A prerelease is a version of devvm that you can try before its release is out, such as a release candidate, `0.2.0-rc.1`, or a beta, `0.2.0-beta.1`. devvm upgrade and the install script never pick a prerelease as the newest release, and the daily release check never announces one, so you get a prerelease only when you name it.
The docs at [devvm.dev](https://devvm.dev/) are for the newest release. The docs for the next release, which a prerelease comes before, are at [next.devvm.dev](https://next.devvm.dev/), and they change as that release is written, so they can describe more than a prerelease has.
To install a prerelease with the install script, run the copy of the script that comes with the prerelease, which installs that prerelease, or give its version to the newest release's script with `--version`:
```sh
curl -fsSL https://github.com/devvmhq/devvm/releases/download/v0.2.0-rc.1/install.sh | bash
curl -fsSL https://github.com/devvmhq/devvm/releases/latest/download/install.sh | bash -s -- --version 0.2.0-rc.1
```
When the install script installed the devvm you have, `devvm upgrade --to 0.2.0-rc.1` installs the prerelease too. Both check a prerelease's signature and checksum as they check a release's. Homebrew's formula always names the newest release, so to try a prerelease on a Homebrew install, switch to the install script first, as [one devvm](#one-devvm) describes.
Versions go in this order: a prerelease comes before its release, a beta before a release candidate, and the numbers in order, so `0.2.0-beta.3` comes before `0.2.0-rc.1`, then `0.2.0-rc.2`, then `0.2.0`. While you run a prerelease, devvm upgrade offers the release it comes before once that release is out, and the daily check says so. It never offers a newer prerelease, such as `0.2.0-rc.2`, so install one with `devvm upgrade --to 0.2.0-rc.2`.
To go back to the newest release before the prerelease's own release is out, name the newest release's version, such as `devvm upgrade --to 0.1.0`. devvm upgrade asks first, because that release is older than the prerelease you have.
### devvm upgrade --json
`devvm upgrade --json` prints what `devvm upgrade --check` says as one JSON object, for scripts, as [output for scripts](command-line.md#output-for-scripts) describes, and installs nothing:
- `current` is the version of the devvm you ran.
- `latest` is the newest release's version.
- `latest` is the newest release's version, which is never a prerelease's.
- `newer` says whether that's newer than `current`.
- `install` is how devvm was installed, `install.sh`, `homebrew` or `other`.
- `path` is where the devvm you ran is, its links followed.
+4
View File
@@ -0,0 +1,4 @@
User-agent: *
{{- if site.Params.noindex }}
Disallow: /
{{- end }}
+16
View File
@@ -0,0 +1,16 @@
# next.devvm.dev: main's docs, for the next release. The Docs workflow builds it with
# `hugo -s docs --minify --config hugo.yaml,next.yaml`, which merges this over hugo.yaml.
# devvm.dev's build, `hugo -s docs --minify`, never reads it.
baseURL: https://next.devvm.dev/
# Search engines skip every page: Hextra's head says noindex for a page whose noindex
# param is set, and layouts/robots.txt disallows everything when the site's is.
cascade:
- params:
noindex: true
params:
noindex: true
banner:
key: next-docs
message: "These docs are for the next devvm, which isn't released yet. The docs for the current release are at [devvm.dev](https://devvm.dev/)."
+4 -4
View File
@@ -4,10 +4,11 @@ go 1.27.3
require (
github.com/BurntSushi/toml v1.6.0
github.com/nicksnyder/go-i18n/v2 v2.6.1
github.com/nicksnyder/go-i18n/v2 v2.7.0
github.com/rogpeppe/go-internal v1.16.0
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.9
github.com/spf13/pflag v1.0.10
golang.org/x/crypto v0.58.0
golang.org/x/sys v0.49.0
golang.org/x/term v0.47.0
golang.org/x/text v0.43.0
@@ -17,7 +18,6 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.58.0 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/tools v0.51.0 // indirect
)
+6 -9
View File
@@ -4,31 +4,28 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/nicksnyder/go-i18n/v2 v2.6.1 h1:JDEJraFsQE17Dut9HFDHzCoAWGEQJom5s0TRd17NIEQ=
github.com/nicksnyder/go-i18n/v2 v2.6.1/go.mod h1:Vee0/9RD3Quc/NmwEjzzD7VTZ+Ir7QbXocrkhOzmUKA=
github.com/nicksnyder/go-i18n/v2 v2.7.0 h1:oiVQUmuCeNggvm/fUVb6/R0aP82BDVphZnmVHwut+J0=
github.com/nicksnyder/go-i18n/v2 v2.7.0/go.mod h1:ZMYiWg8ndQSGNk4zbzbyJjrrVjQjuQ8pERFrnBik+c8=
github.com/rogpeppe/go-internal v1.16.0 h1:O9DK+vNMDVGLr2BeZqmpLeMjiMNkuXfcqntWbZV6S5g=
github.com/rogpeppe/go-internal v1.16.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI=
golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+8 -6
View File
@@ -2,7 +2,7 @@
# Install or upgrade devvm, then offer to install what it needs (Lima; on Linux, QEMU and KVM access).
# curl -fsSL https://github.com/devvmhq/devvm/releases/latest/download/install.sh | bash
# ... | bash -s -- --yes answer yes to every question
# ... | bash -s -- --version 0.1.0 a given release (also DEVVM_VERSION)
# ... | bash -s -- --version 0.1.0 a given release, or a prerelease such as 0.2.0-rc.1 (also DEVVM_VERSION)
# ... | bash -s -- --no-deps devvm only
# ... | bash -s -- --force install even when Homebrew installed devvm
# devvm (its binary, with its README, changelog and license) goes in ~/.local/lib/devvm/<version>,
@@ -32,7 +32,7 @@ usage() {
Install or upgrade devvm ($repo_url), then offer to install what it needs.
usage: install.sh [--yes] [--version VERSION] [--no-deps] [--force]
--yes answer yes to every question
--version install that release instead of the latest (also DEVVM_VERSION)
--version install that release, or a prerelease, instead of the latest (also DEVVM_VERSION)
--no-deps install devvm only
--force install even when Homebrew installed devvm, leaving two copies
devvm goes in $prefix/lib/devvm/<version>, linked from $prefix/bin/devvm (DEVVM_PREFIX changes $prefix).
@@ -113,17 +113,19 @@ check_brew() {
sha256() { if command -v sha256sum >/dev/null; then sha256sum "$1"; else shasum -a 256 "$1"; fi | cut -c1-64; }
# latest_release REPO_URL: the version of a GitHub repo's latest release, from where releases/latest
# redirects (no API, so no rate limit).
# redirects (no API, so no rate limit). GitHub's latest release is never a prerelease, and one there
# anyway is refused: only --version installs a prerelease.
latest_release() {
local url
url=$(fetch -I -o /dev/null -w '%{url_effective}' "$1/releases/latest") ||
die "couldn't find the latest release at $1/releases"
[[ $url == */tag/v* ]] || die "no release found at $1/releases"
valid_version "${url##*/tag/v}" || die "$1's latest release has an odd version: '${url##*/tag/v}'"
[[ ${url##*/tag/v} != *-* ]] || die "$1's latest release is a prerelease: '${url##*/tag/v}'"
echo "${url##*/tag/v}"
}
# It goes into URLs and paths: digits and dots, and maybe a -suffix.
# It goes into URLs and paths: digits and dots, and maybe a -suffix, as a prerelease's 0.2.0-rc.1 has.
valid_version() { [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; }
# The release to install: --version, DEVVM_VERSION, this script's own release, else the latest.
@@ -324,8 +326,8 @@ install_deps() {
case $key in
lima)
if [[ -n $fix ]]; then # Homebrew's
if ask "devvm needs Lima 2.0 or newer, working. Run $fix?"; then run_fix "$fix"; else echo " skipped: $fix"; fi
elif ask "devvm needs Lima 2.0 or newer. Install Lima's latest release into $prefix?"; then
if ask "devvm needs Lima 2.2 or newer, working. Run $fix?"; then run_fix "$fix"; else echo " skipped: $fix"; fi
elif ask "devvm needs Lima 2.2 or newer. Install Lima's latest release into $prefix?"; then
install_lima_tarball
else
echo " skipped: see https://lima-vm.io/docs/installation/"
+24 -4
View File
@@ -17,7 +17,7 @@ import (
// only their first number is compared (major).
const (
minMacOS = "13"
minLima = "2.0"
minLima = "2.2"
)
// Problems lists what Lima needs that this host lacks: macOS minMacOS or
@@ -70,10 +70,10 @@ func (l *host) limaProblem(ctx context.Context) (backend.Problem, bool) {
}
ver := l.limaVersion(ctx)
const command = "limactl --version"
switch n := major(strings.TrimPrefix(ver, "v")); {
case n < 0:
switch v := strings.TrimPrefix(ver, "v"); {
case major(v) < 0:
return problem("brew reinstall lima", msg.ProgramBroken(command, "Lima"), func(fix string) msg.M { return msg.ProgramBrokenFix(command, fix, "Lima") })
case n < major(minLima):
case older(v, minLima):
return problem("brew upgrade lima", msg.ProgramOld(minLima, "Lima", ver), func(fix string) msg.M { return msg.ProgramOldFix(fix, "Lima", ver) })
}
return backend.Problem{}, false
@@ -166,3 +166,23 @@ func major(v string) int {
}
return n
}
// older reports whether version v's major and minor numbers come before
// minimum's (2.1.9 before 2.2); a missing minor is 0.
func older(v, minimum string) bool {
if a, b := major(v), major(minimum); a != b {
return a < b
}
return minor(v) < minor(minimum)
}
// minor is a version's second number (4 for 13.4.1), or 0.
func minor(v string) int {
_, rest, _ := strings.Cut(v, ".")
s, _, _ := strings.Cut(rest, ".")
n, err := strconv.Atoi(s)
if err != nil {
return 0
}
return n
}
+7 -1
View File
@@ -51,8 +51,14 @@ func TestProblems(t *testing.T) {
},
{
name: "Lima 1", path: []string{"limactl"}, version: "limactl version 1.2.0\n",
want: []string{"lima||program_old min=2.0 name=Lima version=1.2.0"},
want: []string{"lima||program_old min=2.2 name=Lima version=1.2.0"},
},
{
name: "Lima 2.1", path: []string{"limactl"}, version: "limactl version 2.1.9\n",
want: []string{"lima||program_old min=2.2 name=Lima version=2.1.9"},
},
{name: "Lima 2.2.0", path: []string{"limactl"}, version: "limactl version 2.2.0\n"},
{name: "Lima 3.0", path: []string{"limactl"}, version: "limactl version 3.0.0\n"},
{
name: "Lima 1, Homebrew", path: []string{"limactl", "brew"}, version: "limactl version 1.2.0\n",
want: []string{"lima|brew upgrade lima|program_old_fix fix=brew upgrade lima name=Lima version=1.2.0"},
+2 -2
View File
@@ -35,7 +35,7 @@ func TestCompleteParts(t *testing.T) {
flag, in string
want []string
}{
{"tools", "", []string{"node", "python", "rust", "go", "none"}},
{"tools", "", []string{"node", "python", "rust", "go", "dotnet", "none"}},
{"tools", "node,p", []string{"node,python"}},
{"agents", "c", []string{"claude", "codex"}},
{"agents", "n", []string{"none"}},
@@ -58,7 +58,7 @@ func TestCompleteToolNames(t *testing.T) {
}{
{nil, "c", []string{"claude", "codex"}},
{[]string{"claude"}, "c", []string{"codex"}},
{[]string{"node"}, "", []string{"python", "rust", "go", "claude", "codex", "opencode"}},
{[]string{"node"}, "", []string{"python", "rust", "go", "dotnet", "claude", "codex", "opencode"}},
{nil, "node+", nil},
} {
if got, _ := completeToolNames(nil, tc.args, tc.in); !slices.Equal(got, tc.want) {
+1 -1
View File
@@ -182,7 +182,7 @@ func TestPartFlags(t *testing.T) {
{"tools", "none", ""},
{"tools", "claude", "part_other_flag flag=--tools given=claude other=--agents"},
{"tools", "node,mine", "part_other_flag flag=--tools given=mine other=--layers"},
{"tools", "java", "unknown_part flag=--tools given=java names=node python rust go"},
{"tools", "java", "unknown_part flag=--tools given=java names=node python rust go dotnet"},
{"tools", "pyhton", "unknown_part_like flag=--tools given=pyhton like=python"},
{"tools", "node,none", "part_none_alone flag=--tools"},
{"tools", ",", "part_none_alone flag=--tools"},
+93
View File
@@ -0,0 +1,93 @@
package cli
import (
"io/fs"
"os"
"path/filepath"
"regexp"
"slices"
"strings"
"testing"
"github.com/devvmhq/devvm/internal/image"
)
// listedToolchains are the files that may list every toolchain: the
// toolchains page, which owns the list, and the two home pages, where it
// helps a visitor decide. A list about something else, such as what an
// e2e image holds, gets its file here with why.
func listedToolchains() []string {
return []string{
"docs/content/docs/using/toolchains.md",
"docs/content/_index.md",
"README.md",
// the e2e images' contents and the e2e sections' tools, not the
// toolchains' list
"docs/content/docs/using/from.md",
"docs/content/docs/contributing/_index.md",
// design notes on the shared tools' mechanisms
"docs/content/docs/internals/design.md",
}
}
// sentencesOf is text's sentences: each line's, split at sentenceEnd.
func sentencesOf(text string) []string {
var out []string
for line := range strings.SplitSeq(text, "\n") {
out = append(out, sentenceEnd.Split(line, -1)...)
}
return out
}
// The toolchains are listed once, on the toolchains page (and the home
// pages): a sentence elsewhere in the docs, the in-VM guide, the messages
// or the issue forms that names three or more of image.Toolchains links to
// that page instead, so a new toolchain changes one list.
func TestToolchainsListedOnce(t *testing.T) {
var files []string
for _, dir := range []string{"docs/content", "assets/guest", ".github/ISSUE_TEMPLATE"} {
err := filepath.WalkDir(filepath.Join(repoRoot, dir), func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() && d.Name() == "cli" {
return filepath.SkipDir // generated from the help
}
if !d.IsDir() && (strings.HasSuffix(path, ".md") || strings.HasSuffix(path, ".yml")) {
files = append(files, path)
}
return nil
})
if err != nil {
t.Fatal(err)
}
}
files = append(files, filepath.Join(repoRoot, "locales", "en.toml"))
names := make([]*regexp.Regexp, len(image.Toolchains))
for i, n := range image.Toolchains {
// the name as a word, not part of a file's name such as
// .node-version, go.mod or rust-toolchain.toml
names[i] = regexp.MustCompile(`(?:^|[^\w./-])` + regexp.QuoteMeta(n) + `(?:$|[^\w./-]|\.\s|\.$)`)
}
for _, path := range files {
rel, _ := filepath.Rel(repoRoot, path)
if slices.Contains(listedToolchains(), filepath.ToSlash(rel)) {
continue
}
data, err := os.ReadFile(path) //nolint:gosec // G304 the repo's own files
if err != nil {
t.Fatal(err)
}
for _, s := range sentencesOf(string(data)) {
n := 0
for _, re := range names {
if re.MatchString(s) {
n++
}
}
if n >= 3 {
t.Errorf("%s lists the toolchains (%q): link the toolchains page instead, or give one example", rel, strings.TrimSpace(s))
}
}
}
}
+1 -1
View File
@@ -100,7 +100,7 @@ func newToolsAddCmd(a *app) *cobra.Command {
Use: "add TOOL...",
Short: "Add shared tools to this folder's VM, then open a shell in it",
Long: "Add shared tools to this folder's VM, then open a shell in it. " +
"TOOL is node, python, rust, go, claude, codex or opencode, each a separate word. " +
"TOOL is a toolchain, such as node, or a coding agent, such as claude, each a separate word. " +
"devvm builds any of them that aren't built, and for a new agent in a running VM it asks before restarting the VM.",
Example: examples(
"devvm tools add claude", "add Claude Code to the VM",
+4 -1
View File
@@ -35,6 +35,7 @@ func newUpgradeCmd(a *app) *cobra.Command {
"devvm upgrade --check", "say whether a newer release is out",
"devvm upgrade --force", "install it without asking, as a script must",
"devvm upgrade --to 0.1.0", "install that release, even an older one",
"devvm upgrade --to 0.2.0-rc.1", "install a prerelease, which only --to installs",
),
Args: noArgs,
ValidArgsFunction: cobra.NoFileCompletions,
@@ -52,7 +53,7 @@ func newUpgradeCmd(a *app) *cobra.Command {
}
f := cmd.Flags()
f.BoolVar(&o.check, "check", false, "say whether a newer release is out, and install nothing")
f.StringVar(&o.Version, "to", "", "install the release `VERSION` instead of the newest, even one older than this devvm")
f.StringVar(&o.Version, "to", "", "install the release `VERSION` instead of the newest, even an older one or a prerelease")
addForceFlag(f, &o.Force)
jsonFlag(cmd, &o.asJSON)
exclusive(cmd, "check", "force")
@@ -127,6 +128,8 @@ func showUpgrade(ctx context.Context, a *app, up upgrade.Upgrader, asJSON bool)
u.Info(msg.UpgradeAvailable(av.Current, av.Latest))
case av.Latest == av.Current:
u.Info(msg.UpgradeAlreadyLatest(av.Current))
case upgrade.Prerelease(av.Current):
u.Info(msg.UpgradePrereleaseAhead(av.Current, av.Latest))
default:
u.Info(msg.UpgradeLatestOlder(av.Current, av.Latest))
}
+16 -3
View File
@@ -42,6 +42,11 @@ const (
// Rustup installs it: rustup, pinned in build.sh, checks the toolchain
// against its own signed manifest, so the lock has no download for it.
Rustup
// DotnetSDK installs it: build.sh unpacks Microsoft's SDK archive, the
// lock's download, checked against the SHA-512 that devvm adds to the
// lock from Microsoft's release metadata. mise's own installer for it
// runs Microsoft's install script, which nothing pins or checks.
DotnetSDK
)
// ToolDef is a shared tool as devvm offers it: what a VM is given by its
@@ -55,7 +60,9 @@ type ToolDef struct {
// that its name stands for, itself first: node is node, pnpm and bun.
Members []string
// Detect are the files in a project folder's top level that call for
// it, in the order they're looked for: the first found is named.
// it, in the order they're looked for: the first found is named. A
// name with a * is a pattern (path.Match's), which names the first
// file it matches, in the folder's name order.
Detect []string
// Installer is what installs it.
Installer Installer
@@ -70,6 +77,7 @@ var SharedTools = []ToolDef{
{Name: "python", Kind: Toolchain, Members: []string{"python", "uv"}, Detect: []string{"pyproject.toml", "requirements.txt", "uv.lock", "setup.py", "Pipfile"}},
{Name: "rust", Kind: Toolchain, Members: []string{"rust"}, Detect: []string{"Cargo.toml"}, Installer: Rustup},
{Name: "go", Kind: Toolchain, Members: []string{"go"}, Detect: []string{"go.mod"}},
{Name: "dotnet", Kind: Toolchain, Members: []string{"dotnet"}, Detect: []string{"*.sln", "*.slnx", "*.csproj", "*.fsproj", "global.json"}, Installer: DotnetSDK},
{Name: "claude", Kind: Agent, Members: []string{"claude"}},
{Name: "codex", Kind: Agent, Members: []string{"codex"}},
{Name: "opencode", Kind: Agent, Members: []string{"opencode"}},
@@ -152,7 +160,12 @@ func GroupTools(name string) []string {
// NoDownload reports whether a tool in the lock needs no download there,
// as its shared tool's installer fetches it: rust, which rustup installs.
func NoDownload(tool string) bool { return installerOf(tool) != Mise }
func NoDownload(tool string) bool { return installerOf(tool) == Rustup }
// OwnDownload reports whether shared-tools/build.sh fetches a tool's
// download from the lock itself, rather than mise or rustup: dotnet,
// whose download and checksum devvm adds to the lock.
func OwnDownload(tool string) bool { return installerOf(tool) == DotnetSDK }
// installerOf is what installs a tool in the lock: its shared tool's
// Installer, mise for a tool no shared tool has.
@@ -226,7 +239,7 @@ func ToolVersion(s string) bool { return toolVersion.MatchString(s) }
// shared-tools/build.sh (in assets, devvm's own files) as its build runs
// it, after the prelude (OwnScript), the [settings] of
// devvm's shared-tools/mise.toml, which change what mise installs, the
// version of mise that installs it (MiseVersion; not for a tool rustup
// version of mise that installs it (MiseVersion; only for a tool mise
// installs), the libc, the base it builds in (devvm's own for gnu, for
// musl its digest) and, unless it's build.sh's own, the format.
func ToolFile(assets fs.FS, t Tool) (string, error) {
+21 -12
View File
@@ -134,17 +134,21 @@ func TestToolFile(t *testing.T) {
if got := toolFile(t, withBase(root, baseScript+"# edit\nnode_version=1\n"), node()); got != f {
t.Errorf("the rest of base.sh: %q, want %q", got, f)
}
// rustup installs rust: mise's version doesn't count, and base.sh's
// pin isn't read.
rust := Tool{Name: "rust", Version: "1.99.1", LockEntry: []byte("[[tools.rust]]\n"), Libc: "gnu"}
r := toolFile(t, root, rust)
if got := toolFile(t, withBase(root, "mise_version=2026.2.0\n"), rust); got != r {
t.Errorf("rust with another mise: %q, want %q", got, r)
}
// rustup installs rust, and build.sh dotnet: mise's version doesn't
// count, and base.sh's pin isn't read.
noBase := maps.Clone(root)
delete(noBase, "layers/base.sh")
if got := toolFile(t, noBase, rust); got != r {
t.Errorf("rust without base.sh: %q, want %q", got, r)
for _, tool := range []Tool{
{Name: "rust", Version: "1.99.1", LockEntry: []byte("[[tools.rust]]\n"), Libc: "gnu"},
{Name: "dotnet", Version: "10.0.403", LockEntry: []byte("[[tools.dotnet]]\n"), Libc: "gnu"},
} {
r := toolFile(t, root, tool)
if got := toolFile(t, withBase(root, "mise_version=2026.2.0\n"), tool); got != r {
t.Errorf("%s with another mise: %q, want %q", tool.Name, got, r)
}
if got := toolFile(t, noBase, tool); got != r {
t.Errorf("%s without base.sh: %q, want %q", tool.Name, got, r)
}
}
}
@@ -275,19 +279,24 @@ func TestSortToolsAndGroups(t *testing.T) {
}
// The table's views: the toolchains, then the agents; rust alone needs
// no download in the lock.
// no download in the lock, and dotnet alone has build.sh fetch its own.
func TestSharedTools(t *testing.T) {
if want := []string{"node", "python", "rust", "go"}; !slices.Equal(Toolchains, want) {
if want := []string{"node", "python", "rust", "go", "dotnet"}; !slices.Equal(Toolchains, want) {
t.Errorf("Toolchains = %q, want %q", Toolchains, want)
}
if want := []string{"claude", "codex", "opencode"}; !slices.Equal(Agents, want) {
t.Errorf("Agents = %q, want %q", Agents, want)
}
for tool, want := range map[string]bool{"rust": true, "node": false, "pnpm": false, "claude": false, "nix": false} {
for tool, want := range map[string]bool{"rust": true, "dotnet": false, "node": false, "pnpm": false, "claude": false, "nix": false} {
if got := NoDownload(tool); got != want {
t.Errorf("NoDownload(%s) = %v, want %v", tool, got, want)
}
}
for tool, want := range map[string]bool{"dotnet": true, "rust": false, "node": false, "claude": false, "nix": false} {
if got := OwnDownload(tool); got != want {
t.Errorf("OwnDownload(%s) = %v, want %v", tool, got, want)
}
}
if _, ok := Def("pnpm"); ok {
t.Error("Def(pnpm): a member isn't a shared tool")
}
+2
View File
@@ -25,6 +25,7 @@ var docs = map[string]string{ //nolint:gosec // message IDs and pages, not crede
"upgrade_no_latest": "using/upgrading#upgrading",
"upgrade_latest_older": "using/upgrading#an-older-release",
"upgrade_brew_version": "using/upgrading#an-older-release",
"upgrade_prerelease_ahead": "using/upgrading#trying-a-prerelease",
"upgrade_checkout_build": "using/upgrading#how-devvm-upgrade-upgrades",
"upgrade_go_install": "using/upgrading#how-devvm-upgrade-upgrades",
"upgrade_other_install": "using/upgrading#how-devvm-upgrade-upgrades",
@@ -415,6 +416,7 @@ var docs = map[string]string{ //nolint:gosec // message IDs and pages, not crede
"fetch_failed": "using/clone#deleting-the-vm",
"mise_download_failed": "using/images#shared-tools",
"tools_resolve_failed": "using/images#shared-tools",
"tools_untrusted": "using/settings#a-companys-ca",
"tool_bad_version": "using/toolchains#adding-and-removing-tools",
"vm_lacks": "using/toolchains#adding-and-removing-tools",
"rule_missing": "safety/network#changing-rules",
+13 -1
View File
@@ -3564,6 +3564,11 @@ func ToolsUnmounted(tools string, vm string) M {
return M{id: "tools_unmounted", vals: []val{{"tools", tools}, {"vm", vm}}}
}
// ToolsUntrusted is [tools_untrusted]: "Resolving the shared tools' versions failed because this machine doesn't trust a server's certificate. A network that inspects TLS needs its CA in this machine's store, or on Linux in {{.dir}}."
func ToolsUntrusted(dir string) M {
return M{id: "tools_untrusted", vals: []val{{"dir", dir}}}
}
// ToolsWrongBase is [tools_wrong_base]: "Image {{.key}} isn't the base these shared tools are built for, so devvm didn't build them in it. Run the command again."
func ToolsWrongBase(key string) M {
return M{id: "tools_wrong_base", vals: []val{{"key", key}}}
@@ -3804,7 +3809,7 @@ func UpgradeNoLatest(url string) M {
return M{id: "upgrade_no_latest", vals: []val{{"url", url}}}
}
// UpgradeNotVersion is [upgrade_not_version]: "--to takes a release's version, such as 0.2.0, not {{.value}}."
// UpgradeNotVersion is [upgrade_not_version]: "--to takes a release's version, such as 0.2.0 or 0.2.0-rc.1, not {{.value}}."
func UpgradeNotVersion(value string) M {
return M{id: "upgrade_not_version", vals: []val{{"value", value}}}
}
@@ -3819,6 +3824,11 @@ func UpgradeOtherInstall(path string) M {
return M{id: "upgrade_other_install", vals: []val{{"path", path}}}
}
// UpgradePrereleaseAhead is [upgrade_prerelease_ahead]: "This is devvm {{.current}}, a prerelease newer than the newest release, devvm {{.latest}}, so nothing was installed. To go back to that release, run devvm upgrade --to {{.latest}}."
func UpgradePrereleaseAhead(current string, latest string) M {
return M{id: "upgrade_prerelease_ahead", vals: []val{{"current", current}, {"latest", latest}}}
}
// UpgradeRollbackFailed is [upgrade_rollback_failed]: "The new devvm didn't run, and {{.link}} couldn't be put back, so it points at the new one. Run ln -sfn {{.old}} {{.link}} to put it back."
func UpgradeRollbackFailed(link string, old string) M {
return M{id: "upgrade_rollback_failed", vals: []val{{"link", link}, {"old", old}}}
@@ -4688,6 +4698,7 @@ var specs = map[string]spec{
"tools_resolve_failed": {},
"tools_switch": {fields: []string{"vm"}},
"tools_unmounted": {fields: []string{"tools", "vm"}},
"tools_untrusted": {fields: []string{"dir"}},
"tools_wrong_base": {fields: []string{"key"}},
"ubuntu_bad_signature": {fields: []string{"release", "url"}},
"ubuntu_mirror_invalid": {fields: []string{"setting"}},
@@ -4739,6 +4750,7 @@ var specs = map[string]spec{
"upgrade_not_version": {fields: []string{"value"}},
"upgrade_nothing_installed": {},
"upgrade_other_install": {fields: []string{"path"}},
"upgrade_prerelease_ahead": {fields: []string{"current", "latest"}},
"upgrade_rollback_failed": {fields: []string{"link", "old"}},
"upstream_proxy_gone": {fields: []string{"file", "vm_name"}},
"upstream_proxy_invalid": {fields: []string{"setting"}},
+31 -4
View File
@@ -13,9 +13,13 @@ import (
// mise stands in for the host's mise (DEVVM_HOST_MISE). It logs every
// call to $STUB_LOG, when that's set. mise lock writes $MISE_STUB_LOCK as
// ./mise.lock, or $MISE_STUB_OLDER_LOCK for a mise.toml listing versions
// (the step back's); with MISE_STUB_FAIL set, it fails like mise
// offline. mise ls-remote prints $MISE_STUB_VERSIONS, one a line.
// Anything else succeeds.
// (the step back's), whose mise.toml it copies to $MISE_STUB_OLDER_CONFIG
// when that's set; with MISE_STUB_FAIL set, it fails like mise
// offline, or, set to untrusted, like mise refusing a server's
// certificate, which it logs to $MISE_LOG_FILE too. mise lock copies the
// bundles $MISE_EXTRA_CA_CERTS and $SSL_CERT_FILE name, when they're set,
// to $STUB_DIR/mise-ca.pem and $STUB_DIR/mise-roots.pem. mise ls-remote
// prints $MISE_STUB_VERSIONS, one a line. Anything else succeeds.
func mise(c *call) int {
c.log()
switch c.arg(0) {
@@ -26,13 +30,36 @@ func mise(c *call) int {
default:
return 0
}
if c.getenv("MISE_STUB_FAIL") != "" {
for name, to := range map[string]string{"MISE_EXTRA_CA_CERTS": "mise-ca.pem", "SSL_CERT_FILE": "mise-roots.pem"} {
if f := c.getenv(name); f != "" {
b, err := readFile(f)
if err == nil {
err = c.put(to, b)
}
if err != nil {
return c.status(err)
}
}
}
switch c.getenv("MISE_STUB_FAIL") {
case "":
case "untrusted":
line := "mise WARN Remote versions cannot be fetched for pnpm/pnpm: error sending request: client error (Connect): invalid peer certificate: UnknownIssuer"
c.say(line)
c.logLine(c.getenv("MISE_LOG_FILE"), line)
return 1
default:
c.say("mise ERROR failed to fetch versions: offline")
return 1
}
lock := c.getenv("MISE_STUB_LOCK")
if toml, err := readFile("mise.toml"); err == nil && bytes.Contains(toml, []byte("= [")) {
lock = c.getenv("MISE_STUB_OLDER_LOCK")
if keep := c.getenv("MISE_STUB_OLDER_CONFIG"); keep != "" {
if err := writeFile(keep, toml); err != nil {
return c.status(err)
}
}
}
b, err := readFile(lock)
if err != nil {
+15
View File
@@ -725,6 +725,21 @@ func TestMise(t *testing.T) {
s.fails(1, "mise", "lock")
s.env["MISE_STUB_FAIL"] = "1"
s.fails(1, "mise", "lock")
// A certificate it doesn't trust, in its log file too; the bundle it
// was pointed at, copied.
s.env["MISE_STUB_FAIL"] = "untrusted"
s.env["MISE_LOG_FILE"] = filepath.Join(s.dir, "mise.log")
s.write("bundle.pem", "roots")
s.env["MISE_EXTRA_CA_CERTS"] = filepath.Join(s.dir, "bundle.pem")
s.write("roots.pem", "system")
s.env["SSL_CERT_FILE"] = filepath.Join(s.dir, "roots.pem")
s.fails(1, "mise", "lock")
if !strings.Contains(s.read("mise.log"), "invalid peer certificate: UnknownIssuer") {
t.Error("no certificate error in its log")
}
if s.read("mise-ca.pem") != "roots" || s.read("mise-roots.pem") != "system" {
t.Error("the bundles")
}
}
// The host's other stand-ins: open, code, qemu-img, sw_vers, uname and
+171
View File
@@ -0,0 +1,171 @@
package tools
import (
"encoding/pem"
"errors"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"slices"
"strings"
"testing"
"github.com/devvmhq/devvm/internal/backend"
"github.com/devvmhq/devvm/internal/image"
"github.com/devvmhq/devvm/internal/msg"
)
// caPEM is a CA's certificate, PEM, as a company's would be: the TLS test
// server's, which is a CA's.
func caPEM(srv *httptest.Server) []byte {
return pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: srv.Certificate().Raw})
}
// envOf is the value of key in a command's environment, the last one set,
// as exec's is.
func envOf(env []string, key string) (string, bool) {
for _, kv := range slices.Backward(env) {
if v, ok := strings.CutPrefix(kv, key+"="); ok {
return v, true
}
}
return "", false
}
// The host's mise trusts the user's CAs as well as this machine's own:
// MISE_EXTRA_CA_CERTS names their bundle, in mise's own folder, on Linux
// and macOS alike, and on Linux SSL_CERT_FILE names a bundle of the
// host's and theirs there too. Without CAs neither is named, and a CA
// folder devvm refuses fails it.
func TestMiseTrustsCAs(t *testing.T) {
srv := httptest.NewTLSServer(http.NotFoundHandler())
defer srv.Close()
ca := caPEM(srv)
cases := []struct {
name, os string
cas []byte // the CA folder's company.pem; nil for none
want bool // MISE_EXTRA_CA_CERTS names devvm's bundle
roots bool // SSL_CERT_FILE names the host's and the user's
err string // the refusal's names
}{
{name: "linux with a CA", os: "linux", cas: ca, want: true, roots: true},
{name: "macos with a CA", os: "darwin", cas: ca, want: true},
{name: "without", os: "linux"},
{name: "a key in the folder", os: "linux", cas: []byte("-----BEGIN PRIVATE KEY-----\nAAAA\n-----END PRIVATE KEY-----\n"), err: "ca_not_certificate"},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
e := newEnv(t)
e.OS = c.os
own := writeTemp(t, []byte("the host's roots"))
e.Getenv = func(k string) string {
if k == "SSL_CERT_FILE" {
return own
}
return ""
}
if c.cas != nil {
write(t, filepath.Join(e.Dirs.TrustedCAs(), "company.pem"), c.cas)
}
dir := t.TempDir()
cmd, err := e.miseCmd(t.Context(), e.Mise, dir, "lock")
if c.err != "" {
if !strings.HasPrefix(msg.NamesOf(err), c.err+" ") {
t.Fatalf("miseCmd = %v, want %s", msg.NamesOf(err), c.err)
}
return
}
if err != nil {
t.Fatal(err)
}
physical, err := filepath.EvalSymlinks(dir)
if err != nil {
t.Fatal(err)
}
if got, _ := envOf(cmd.Env, "MISE_LOG_FILE"); got != filepath.Join(physical, miseLog) {
t.Errorf("MISE_LOG_FILE = %q", got)
}
got, _ := envOf(cmd.Env, "MISE_EXTRA_CA_CERTS")
bundle := filepath.Join(physical, "devvm-ca.pem")
if (got == bundle) != c.want {
t.Fatalf("MISE_EXTRA_CA_CERTS = %q", got)
}
if !c.want {
if _, err := os.Stat(bundle); !errors.Is(err, os.ErrNotExist) {
t.Error("a bundle was written")
}
return
}
if b := string(read(t, bundle)); b != string(ca) {
t.Errorf("bundle = %q", b)
}
got, _ = envOf(cmd.Env, "SSL_CERT_FILE")
roots := filepath.Join(physical, "devvm-roots.pem")
if (got == roots) != c.roots {
t.Fatalf("SSL_CERT_FILE = %q", got)
}
if c.roots {
if b := string(read(t, roots)); b != "the host's roots\n"+string(ca) {
t.Errorf("roots = %q", b)
}
} else if _, err := os.Stat(roots); !errors.Is(err, os.ErrNotExist) {
t.Error("roots were written")
}
})
}
}
// The download of the host's mise trusts the user's CAs as well as this
// machine's own: a server whose certificate only the CA folder has is
// refused without it, as tools_untrusted.
func TestHostMiseTrustsCAs(t *testing.T) {
body := []byte("#!/bin/sh\necho mise\n")
srv := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { _, _ = w.Write(body) }))
defer srv.Close()
sum, err := image.SHA256File(writeTemp(t, body))
if err != nil {
t.Fatal(err)
}
for _, trusted := range []bool{false, true} {
e := newEnv(t)
e.Mise = ""
e.OS, e.Arch = "linux", "amd64"
e.miseURL = srv.URL + "/v%[1]s/mise-v%[1]s-%[2]s"
e.miseSums = map[string]string{"linux-x64": sum}
if trusted {
write(t, filepath.Join(e.Dirs.TrustedCAs(), "company.pem"), caPEM(srv))
}
_, err := e.HostMise(t.Context())
if trusted && err != nil {
t.Errorf("with the CA: %v", msg.NamesOf(err))
}
if !trusted && msg.NamesOf(err) != "tools_untrusted dir="+e.Dirs.TrustedCAs() {
t.Errorf("without the CA: %v", msg.NamesOf(err))
}
}
}
// A certificate mise doesn't trust, in its log, is tools_untrusted, which
// names the CA folder, both when the lock is resolved first and when it's
// resolved again; failing otherwise stays what it was.
func TestResolveUntrusted(t *testing.T) {
e := newEnv(t)
t.Setenv("MISE_STUB_FAIL", "untrusted")
want := "tools_untrusted dir=" + e.Dirs.TrustedCAs()
_, err := e.Lock(t.Context())
if _, ok := errors.AsType[*backend.LoggedError](err); !ok || msg.NamesOf(err) != want {
t.Errorf("Lock = %v", msg.NamesOf(err))
}
if _, err := os.Stat(e.Dirs.ToolLock()); !errors.Is(err, os.ErrNotExist) {
t.Error("a lock was written")
}
e.locked(t, fixture(t))
if err := e.Refresh(t.Context()); msg.NamesOf(err) != want {
t.Errorf("Refresh = %v", msg.NamesOf(err))
}
t.Setenv("MISE_STUB_FAIL", "1")
if err := e.Refresh(t.Context()); msg.NamesOf(err) != "tools_resolve_failed" {
t.Errorf("Refresh offline = %v", msg.NamesOf(err))
}
}
+172
View File
@@ -0,0 +1,172 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"maps"
"regexp"
"slices"
"strings"
"github.com/devvmhq/devvm/internal/fetch"
"github.com/devvmhq/devvm/internal/image"
)
// The .NET SDK's downloads. mise locks dotnet's version alone, without a
// download, as its installer runs Microsoft's install script, which
// nothing pins and which checks nothing. So devvm adds each platform's SDK
// archive and its SHA-512 to the lock's dotnet entries from Microsoft's
// release metadata, as mise does for the other tools from their releases'
// checksums, and shared-tools/build.sh checks the archive against the lock.
// dotnetReleases is where Microsoft lists a .NET channel's releases, each
// SDK with its files and their SHA-512: a format taking the channel, such
// as 10.0.
const dotnetReleases = "https://builds.dotnet.microsoft.com/dotnet/release-metadata/%s/releases.json"
// dotnetFiles is where every SDK archive the lock records comes from.
const dotnetFiles = "https://builds.dotnet.microsoft.com/dotnet/"
// releasesCap caps a channel's release list, which is a few MB.
const releasesCap = 32 << 20
var (
dotnetVersion = regexp.MustCompile(`^([0-9]+\.[0-9]+)\.[0-9]+$`)
sha512Hex = regexp.MustCompile(`^[0-9a-f]{128}$`)
)
// dotnetRID is Microsoft's name for a lock's platform: linux-x64-musl is
// linux-musl-x64.
func dotnetRID(platform string) string {
arch, musl := strings.CutSuffix(strings.TrimPrefix(platform, "linux-"), "-musl")
if musl {
return "linux-musl-" + arch
}
return "linux-" + arch
}
// dotnetSDK is an SDK release as a channel's releases.json has it.
type dotnetSDK struct {
Version string `json:"version"`
Files []struct {
Name string `json:"name"`
RID string `json:"rid"`
URL string `json:"url"`
Hash string `json:"hash"`
} `json:"files"`
}
// download is the SDK's archive for a lock's platform and its SHA-512, in
// hex: false when Microsoft lists none, or one that isn't an https URL of
// its own downloads with a SHA-512.
func (s dotnetSDK) download(platform string) (url, sha512 string, ok bool) {
rid := dotnetRID(platform)
for _, f := range s.Files {
h := strings.ToLower(f.Hash)
if f.RID == rid && f.Name == "dotnet-sdk-"+rid+".tar.gz" && strings.HasPrefix(f.URL, dotnetFiles) &&
strings.HasSuffix(f.URL, ".tar.gz") && sha512Hex.MatchString(h) {
return f.URL, h, true
}
}
return "", "", false
}
// dotnetSDKs reads a channel's releases.json: its SDKs, each release's
// own and the others it lists.
func dotnetSDKs(data []byte) ([]dotnetSDK, error) {
var doc struct {
Releases []struct {
SDK *dotnetSDK `json:"sdk"`
SDKs []dotnetSDK `json:"sdks"`
} `json:"releases"`
}
if err := json.Unmarshal(data, &doc); err != nil {
return nil, err
}
var out []dotnetSDK
for _, r := range doc.Releases {
if r.SDK != nil {
out = append(out, *r.SDK)
}
out = append(out, r.SDKs...)
}
return out, nil
}
// withSDKDownloads returns the lock with Microsoft's downloads added to
// each entry of a tool build.sh fetches itself (image.OwnDownload) that
// lacks one for some platform: the SDK's archive, for each platform
// Microsoft has one for, and its SHA-512. Entries with all of them stay as
// they are, and so does a lock where all have them. A version Microsoft
// doesn't list keeps none, which the step back sees; a channel's list it
// can't get fails.
func (t Versions) withSDKDownloads(ctx context.Context, lock Lock) (Lock, error) {
channels := map[string][]dotnetSDK{}
for _, d := range image.SharedTools {
for _, tool := range d.Members {
if !image.OwnDownload(tool) {
continue
}
es := slices.Clone(lock.entries(tool))
changed := false
for i, e := range es {
if hasDownload(e, t.platforms()) {
continue
}
sdk, err := t.dotnetSDK(ctx, channels, str(e, "version"))
if err != nil {
return Lock{}, err
}
e = maps.Clone(e)
for _, p := range t.platforms() {
if url, sum, ok := sdk.download(p); ok {
e["platforms."+p] = map[string]any{"checksum": "sha512:" + sum, "url": url}
es[i], changed = e, true
}
}
}
if !changed {
continue
}
var err error
if lock, err = lock.withEntries(tool, es); err != nil {
return Lock{}, err
}
}
}
return lock, nil
}
// dotnetSDK returns the SDK of a version from its channel's releases.json,
// which it gets once per channel (channels): an empty one when the
// version isn't shaped like an SDK's or the channel doesn't list it.
func (t Versions) dotnetSDK(ctx context.Context, channels map[string][]dotnetSDK, version string) (dotnetSDK, error) {
m := dotnetVersion.FindStringSubmatch(version)
if m == nil {
return dotnetSDK{}, nil
}
sdks, ok := channels[m[1]]
if !ok {
url := fmt.Sprintf(t.dotnetURL, m[1])
var data []byte
err := fetch.Retry(ctx, downloadRetries, t.RetryDelay, func() (bool, error) {
var err error
data, err = fetch.Get(ctx, t.Client, url, releasesCap)
return fetch.Transient(err), err
})
if err == nil {
sdks, err = dotnetSDKs(data)
}
if err != nil {
return dotnetSDK{}, fmt.Errorf("dotnet's releases: %w", err)
}
channels[m[1]] = sdks
}
for _, s := range sdks {
if s.Version == version {
return s, nil
}
}
return dotnetSDK{}, nil
}
+237
View File
@@ -0,0 +1,237 @@
package tools
import (
"bytes"
"net/http"
"net/http/httptest"
"slices"
"strings"
"sync/atomic"
"testing"
"github.com/devvmhq/devvm/internal/backend"
"github.com/devvmhq/devvm/internal/msg"
)
func TestDotnetRID(t *testing.T) {
for platform, want := range map[string]string{
"linux-arm64": "linux-arm64", "linux-x64": "linux-x64",
"linux-arm64-musl": "linux-musl-arm64", "linux-x64-musl": "linux-musl-x64",
} {
if got := dotnetRID(platform); got != want {
t.Errorf("dotnetRID(%s) = %s, want %s", platform, got, want)
}
}
}
// sha512Of is a made-up SHA-512 in hex, one per letter.
func sha512Of(c string) string { return strings.Repeat(c, 128) }
// dotnetChannel is a channel's releases.json as Microsoft writes it, with
// 10.0.402 as a release's SDK and 10.0.110 among its others; 10.0.402's
// files: good ones for arm64 and musl arm64 (an uppercase hash), and for
// x64 one off Microsoft's downloads and one without a SHA-512.
const dotnetChannel = `{"channel-version": "10.0", "releases": [
{"release-version": "10.0.4", "sdk": {"version": "10.0.402", "files": [
{"name": "dotnet-sdk-linux-arm64.tar.gz", "rid": "linux-arm64", "url": "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-arm64.tar.gz", "hash": "` + "aaaa" + `"},
{"name": "dotnet-sdk-linux-arm64.zip", "rid": "linux-arm64", "url": "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-arm64.zip", "hash": "HASH_B"},
{"name": "dotnet-sdk-linux-arm64.tar.gz", "rid": "linux-arm64", "url": "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-arm64.tar.gz", "hash": "HASH_A"},
{"name": "dotnet-sdk-linux-musl-arm64.tar.gz", "rid": "linux-musl-arm64", "url": "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-musl-arm64.tar.gz", "hash": "HASH_C_UPPER"},
{"name": "dotnet-sdk-linux-x64.tar.gz", "rid": "linux-x64", "url": "https://example.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-x64.tar.gz", "hash": "HASH_D"},
{"name": "dotnet-sdk-linux-musl-x64.tar.gz", "rid": "linux-musl-x64", "url": "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-musl-x64.tar.gz", "hash": "abc"}
]}, "sdks": [{"version": "10.0.402", "files": []}, {"version": "10.0.110", "files": [
{"name": "dotnet-sdk-linux-arm64.tar.gz", "rid": "linux-arm64", "url": "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.110/dotnet-sdk-10.0.110-linux-arm64.tar.gz", "hash": "HASH_E"}
]}]},
{"release-version": "10.0.0-rc.1", "sdk": null}
]}`
// channelJSON is dotnetChannel with its made-up hashes.
func channelJSON() string {
return strings.NewReplacer("HASH_A", sha512Of("a"), "HASH_B", sha512Of("b"), "HASH_C_UPPER", strings.ToUpper(sha512Of("c")),
"HASH_D", sha512Of("d"), "HASH_E", sha512Of("e")).Replace(dotnetChannel)
}
// dotnetServer serves channel 10.0's releases.json, counting its requests;
// any other channel is missing.
func dotnetServer(t *testing.T, e env) *atomic.Int32 {
t.Helper()
var n atomic.Int32
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
n.Add(1)
if r.URL.Path != "/10.0/releases.json" {
http.NotFound(w, r)
return
}
_, _ = w.Write([]byte(channelJSON()))
}))
t.Cleanup(srv.Close)
e.dotnetURL = srv.URL + "/%s/releases.json"
return &n
}
// dotnetLock is the fixture with dotnet's entries as mise locks them,
// versions without downloads.
func dotnetLock(t *testing.T, versions ...string) []byte {
t.Helper()
var b bytes.Buffer
in := false
for _, line := range lines(fixture(t)) {
if strings.HasPrefix(line, "[") {
in = strings.HasPrefix(line, "[[tools.dotnet]]") || strings.HasPrefix(line, "[tools.dotnet.")
}
if !in {
b.WriteString(line + "\n")
}
}
for _, v := range versions {
b.WriteString("\n[[tools.dotnet]]\nversion = \"" + v + "\"\nbackend = \"core:dotnet\"\nspecifiers = [\"latest\"]\n")
}
return b.Bytes()
}
// Microsoft's archive and its SHA-512 for each of the VMs' platforms join
// each dotnet entry that has none: from its channel's releases.json, read
// once for all of them, a release's SDK or one of its others; a file off
// Microsoft's downloads, without a SHA-512 or not a tar.gz isn't taken. A
// lock that has them all stays as it is, and so does a version Microsoft
// doesn't list.
func TestWithSDKDownloads(t *testing.T) {
e := newEnv(t)
n := dotnetServer(t, e)
lock, err := e.withSDKDownloads(t.Context(), parsed(t, dotnetLock(t, "10.0.402", "10.0.110", "10.0.499", "10.x")))
if err != nil {
t.Fatal(err)
}
if got := n.Load(); got != 1 {
t.Errorf("%d requests, want 1", got)
}
want := map[string][2]string{
"10.0.402 linux-arm64": {"https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-arm64.tar.gz", "sha512:" + sha512Of("a")},
"10.0.402 linux-arm64-musl": {"https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.402/dotnet-sdk-10.0.402-linux-musl-arm64.tar.gz", "sha512:" + sha512Of("c")},
"10.0.110 linux-arm64": {"https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.110/dotnet-sdk-10.0.110-linux-arm64.tar.gz", "sha512:" + sha512Of("e")},
}
for _, v := range []string{"10.0.402", "10.0.110", "10.0.499", "10.x"} {
for _, p := range []string{"linux-arm64", "linux-arm64-musl", "linux-x64", "linux-x64-musl"} {
table, _ := lock.versionEntry("dotnet", v)["platforms."+p].(map[string]any)
got := [2]string{str(table, "url"), str(table, "checksum")}
if got != want[v+" "+p] {
t.Errorf("%s on %s: %q, want %q", v, p, got, want[v+" "+p])
}
}
}
if url, sum := lock.Download("dotnet", "linux-arm64"); url != want["10.0.402 linux-arm64"][0] || sum != want["10.0.402 linux-arm64"][1] {
t.Errorf("Download = %s %s", url, sum)
}
if !slices.Equal(lockTools(t, lock.Bytes()), lockTools(t, fixture(t))) || !bytes.Equal(entryOf(t, lock.Bytes(), "node"), entryOf(t, fixture(t), "node")) {
t.Error("the other tools changed")
}
for _, have := range [][]byte{fixture(t), dotnetLock(t)} {
again, err := e.withSDKDownloads(t.Context(), parsed(t, have))
if err != nil || !bytes.Equal(again.Bytes(), have) {
t.Errorf("a lock with every download changed: %v", err)
}
}
if got := n.Load(); got != 1 {
t.Errorf("%d requests for locks with every download", got)
}
// x64's: one off Microsoft's downloads, and one without a SHA-512.
sdks, err := dotnetSDKs([]byte(channelJSON()))
if err != nil || len(sdks) != 3 {
t.Fatalf("dotnetSDKs = %d, %v", len(sdks), err)
}
for _, p := range []string{"linux-x64", "linux-x64-musl"} {
if url, _, ok := sdks[0].download(p); ok {
t.Errorf("%s: %s", p, url)
}
}
}
// A channel Microsoft doesn't answer for fails, and so does Resolve, with
// nothing written; with its downloads, Resolve writes them.
func TestResolveSDKDownloads(t *testing.T) {
e := newEnv(t)
e.locked(t, fixture(t))
n := dotnetServer(t, e)
e.stubLocks(t, dotnetLock(t, "9.0.300"), nil, "")
if err := e.Refresh(t.Context()); msg.NamesOf(err) != "tools_resolve_failed" {
t.Errorf("Refresh with a channel that isn't there = %v", msg.NamesOf(err))
}
if !bytes.Equal(read(t, e.Dirs.ToolLock()), fixture(t)) {
t.Error("the lock changed")
}
if got := n.Load(); got != 1 {
t.Errorf("%d requests for a 404, want 1", got)
}
e.stubLocks(t, dotnetLock(t, "10.0.402"), nil, "")
if err := e.Refresh(t.Context()); err != nil {
t.Fatal(msg.NamesOf(err))
}
lock := parsed(t, read(t, e.Dirs.ToolLock()))
if lock.Version("dotnet") != "10.0.402" || !lock.HasDownload("dotnet", e.platforms()) {
t.Errorf("dotnet = %s, with downloads %v", lock.Version("dotnet"), lock.HasDownload("dotnet", e.platforms()))
}
if url, _ := lock.Download("dotnet", "linux-arm64-musl"); !strings.HasSuffix(url, "-linux-musl-arm64.tar.gz") {
t.Errorf("musl's download = %s", url)
}
}
// The newest SDK without a download for a platform steps back, to an
// older one whose downloads devvm added too.
func TestSDKStepsBack(t *testing.T) {
e := newEnv(t)
e.locked(t, fixture(t))
dotnetServer(t, e)
e.stubLocks(t, dotnetLock(t, "10.0.499"), dotnetLock(t, "10.0.402"), "10.0.300 10.0.402 10.0.499")
if err := e.Refresh(t.Context()); err != nil {
t.Fatal(msg.NamesOf(err))
}
if !slices.Contains(*e.said, "devvm: tool_stepped_back older=10.0.402 tool=dotnet version=10.0.499") {
t.Errorf("said %q", *e.said)
}
if lock := parsed(t, read(t, e.Dirs.ToolLock())); lock.Version("dotnet") != "10.0.402" || !lock.HasDownload("dotnet", e.platforms()) {
t.Errorf("dotnet = %s", lock.Version("dotnet"))
}
}
// build.sh gets dotnet's download for the VM's platform and its SHA-512,
// in hex, after its tool, version and file; a download without a SHA-512
// isn't built.
func TestBuildDotnet(t *testing.T) {
e := newEnv(t)
e.locked(t, fixture(t))
lock := parsed(t, fixture(t))
for _, tg := range []struct {
target Target
base string
platform string
}{{gnuT, baseKey, "linux-arm64"}, {muslT, muslKey, "linux-arm64-musl"}} {
f := fake()
file, err := e.File(lock, "dotnet", tg.target)
if err != nil {
t.Fatal(err)
}
if err := e.Build(t.Context(), backend.Review{}, f, tg.base, tg.target, []string{file}); err != nil {
t.Fatal(msg.NamesOf(err))
}
url, sum := lock.Download("dotnet", tg.platform)
spec, _ := f.Calls()[0].Args[0].(backend.ToolsSpec)
if want := []string{"dotnet", "10.0.401", file, url, strings.TrimPrefix(sum, "sha512:")}; !slices.Equal(spec.Args, want) {
t.Errorf("%s: build.sh's arguments %q, want %q", tg.platform, spec.Args, want)
}
}
e = newEnv(t)
sha256 := bytes.ReplaceAll(fixture(t), []byte(`checksum = "sha512:`), []byte(`checksum = "sha256:`))
e.locked(t, sha256)
file, err := e.File(parsed(t, sha256), "dotnet", gnuT)
if err != nil {
t.Fatal(err)
}
f := fake()
if err := e.Build(t.Context(), backend.Review{}, f, baseKey, gnuT, []string{file}); msg.NamesOf(err) != "tool_unbuilt tool=dotnet version=10.0.401" {
t.Errorf("a download without a SHA-512 = %v", msg.NamesOf(err))
}
if len(f.Calls()) != 0 {
t.Errorf("built: %q", f.Methods())
}
e.noLeftovers(t)
}
+42 -4
View File
@@ -7,6 +7,8 @@ import (
"errors"
"maps"
"os"
"slices"
"strconv"
"strings"
"github.com/BurntSushi/toml"
@@ -110,9 +112,9 @@ func (l Lock) Entry(tool string) ([]byte, error) {
}
// HasDownload reports whether a tool's first entry has a download (a URL
// and its checksum, which mise checks it against, not a build from
// source) for every one of the platforms. A tool whose
// installer isn't mise needs none (image.NoDownload): rustup installs rust.
// and its checksum, which mise or build.sh checks it against, not a build
// from source) for every one of the platforms. A tool whose installer
// fetches it needs none (image.NoDownload): rustup installs rust.
func (l Lock) HasDownload(tool string, platforms []string) bool {
if image.NoDownload(tool) {
return true
@@ -144,15 +146,28 @@ func (l Lock) versionEntry(tool, version string) lockEntry {
return nil
}
// Download returns the URL and checksum of a tool's first entry's
// download for a platform: "" for none.
func (l Lock) Download(tool, platform string) (url, checksum string) {
table, _ := l.first(tool)["platforms."+platform].(map[string]any)
return str(table, "url"), str(table, "checksum")
}
// withEntry returns the lock with a tool's entries replaced by e alone,
// written again as TOML.
func (l Lock) withEntry(tool string, e lockEntry) (Lock, error) {
return l.withEntries(tool, []lockEntry{e})
}
// withEntries returns the lock with a tool's entries replaced by es,
// written again as TOML.
func (l Lock) withEntries(tool string, es []lockEntry) (Lock, error) {
doc, ts := map[string]any{}, map[string]any{}
maps.Copy(doc, l.doc)
if old, ok := l.doc["tools"].(map[string]any); ok {
maps.Copy(ts, old)
}
ts[tool] = []map[string]any{e}
ts[tool] = es
doc["tools"] = ts
var b bytes.Buffer
if err := toml.NewEncoder(&b).Encode(doc); err != nil {
@@ -198,3 +213,26 @@ func configTools(data []byte) (names []string, versions map[string]string) {
}
return names, versions
}
// configAliases reads the [tool_alias] table of a mise.toml: each tool
// whose backend it names, and that backend (aqua:openai/codex).
func configAliases(data []byte) (map[string]string, error) {
var config struct {
Aliases map[string]string `toml:"tool_alias"`
}
if err := toml.Unmarshal(data, &config); err != nil {
return nil, err
}
return config.Aliases, nil
}
// aliasTable is a [tool_alias] table as a mise.toml takes it: a line per
// tool, naming its backend, in the tools' order.
func aliasTable(aliases map[string]string) []byte {
var b bytes.Buffer
b.WriteString("[tool_alias]\n")
for _, tool := range slices.Sorted(maps.Keys(aliases)) {
b.WriteString(tool + " = " + strconv.Quote(aliases[tool]) + "\n")
}
return b.Bytes()
}
+115 -21
View File
@@ -1,7 +1,9 @@
package tools
import (
"bytes"
"context"
"crypto/x509"
"errors"
"fmt"
"maps"
@@ -17,17 +19,18 @@ import (
"github.com/devvmhq/devvm/internal/image"
"github.com/devvmhq/devvm/internal/msg"
"github.com/devvmhq/devvm/internal/state"
"github.com/devvmhq/devvm/internal/trust"
)
// The mise devvm resolves the tools lock with, on the host: pinned, and
// checked against its checksum before it runs.
const miseVersion = "2026.10.7"
const miseVersion = "2026.11.3"
var miseSHA256 = map[string]string{
"macos-arm64": "f5171e341518a57e8c4e9280e28443e35d66212c51164c83be76794e0a78b014",
"macos-x64": "c3355f0c56d1b9fe73a2ba30e034b4e483541b25b1ad812a87440abfaeec8baa",
"linux-arm64": "c7108d85a32ba17e4747d31d4a42f39f0c134f16211e204e8ef0a49d4f518fe1",
"linux-x64": "6eb1b890e90818417ca34c90dbbd47881917d5cd199f31b63b062ea9c6b18d85",
"macos-arm64": "6d39119ab914c54ab865204dee9337c71b83a7ed1e730f663c2fc3453e38fe9c",
"macos-x64": "49f32abd93f54147af0599a1c9583d2092df8e7250c9fe635783a7932c4087ef",
"linux-arm64": "a9a2a66bbbe87ea9cc849e1f006606ae2b34f3d3ba56a54d5cd5d64b6557d164",
"linux-x64": "c2f7e814cb39f60b7f67a0ff36cb805e94128bf2dff09d175309d0f095b8cc3b",
}
const miseURL = "https://github.com/jdx/mise/releases/download/v%[1]s/mise-v%[1]s-%[2]s"
@@ -71,6 +74,9 @@ func (t Versions) HostMise(ctx context.Context) (string, error) {
if err := os.MkdirAll(dir, 0o700); err != nil {
return "", err
}
if err := t.trustCAs(); err != nil {
return "", err
}
stop := t.Status(msg.DownloadingMise(miseVersion))
defer stop()
// fetch keeps the download only once its SHA-256 is the pin's, and
@@ -90,6 +96,9 @@ func (t Versions) HostMise(ctx context.Context) (string, error) {
case errors.Is(err, fetch.ErrProxy) && isMsg:
// The company proxy's own refusal, such as its password unsaved.
return "", m
case errors.As(err, new(x509.UnknownAuthorityError)):
// A network that inspects TLS, whose CA this machine doesn't have.
return "", msg.ToolsUntrusted(t.Dirs.TrustedCAs()).Because(err)
case err != nil && ctx.Err() != nil:
return "", ctx.Err()
case err != nil:
@@ -107,7 +116,8 @@ func (t Versions) HostMise(ctx context.Context) (string, error) {
// physical path, stops it at dir. It goes through config.toml's company
// proxy when devvm's environment sets none (Proxy's Env): its
// environment, never its arguments, holds the proxy's password, as mise
// takes it only in the proxy's URL.
// takes it only in the proxy's URL. It trusts the user's CAs (caEnv), and
// logs to a file in dir too (miseLog).
func (t Versions) miseCmd(ctx context.Context, mise, dir string, args ...string) (*exec.Cmd, error) {
dir, err := filepath.EvalSymlinks(dir)
if err != nil {
@@ -117,6 +127,10 @@ func (t Versions) miseCmd(ctx context.Context, mise, dir string, args ...string)
if err != nil {
return nil, err
}
caEnv, err := t.caEnv(dir)
if err != nil {
return nil, err
}
cmd := exec.CommandContext(ctx, mise, args...) //nolint:gosec // devvm's own mise
cmd.Dir = dir
cmd.Env = append(os.Environ(),
@@ -127,15 +141,76 @@ func (t Versions) miseCmd(ctx context.Context, mise, dir string, args ...string)
"MISE_GLOBAL_CONFIG_FILE="+filepath.Join(dir, "config", "none.toml"),
"MISE_TRUSTED_CONFIG_PATHS="+dir,
"MISE_CEILING_PATHS="+filepath.Dir(dir),
"MISE_LOG_FILE="+filepath.Join(dir, miseLog),
)
cmd.Env = append(cmd.Env, proxyEnv...)
cmd.Env = append(cmd.Env, caEnv...)
return cmd, nil
}
// miseLog is the file in its folder that the host's mise logs to as well
// (MISE_LOG_FILE), which resolveFailed reads.
const miseLog = "mise.log"
// untrustedCert is what mise's log says of a server's certificate that
// mise doesn't trust: rustls' error, which mise's TLS is on every host.
const untrustedCert = "invalid peer certificate"
// errUntrusted is what tools_untrusted carries, so Lock keeps it.
var errUntrusted = errors.New("a server's certificate isn't trusted")
// caEnv is what makes the host's mise trust the user's CAs (trust.Read)
// as well as this machine's own, in files in dir, mise's own folder.
// MISE_EXTRA_CA_CERTS names their bundle, which mise adds to its roots on
// every platform, but only in its own HTTP client: its Sigstore client,
// which fetches the trust root that its provenance checks need, ignores
// it. That client reads the system's roots as the rest of mise does, from
// files on Linux, so there SSL_CERT_FILE names a bundle of the system's
// and the user's CAs too (trust.CAs.Host), which every client reads.
// macOS's mise asks the Keychain, which no variable adds to. None without
// CAs.
func (t Versions) caEnv(dir string) ([]string, error) {
cas, err := trust.Read(t.Dirs.TrustedCAs())
if err != nil || len(cas) == 0 {
return nil, err
}
extra := filepath.Join(dir, "devvm-ca.pem")
if err := state.WriteFile(extra, cas.Bundle()); err != nil {
return nil, err
}
env := []string{"MISE_EXTRA_CA_CERTS=" + extra}
if t.OS != "linux" {
return env, nil
}
roots := filepath.Join(dir, "devvm-roots.pem")
bundle, rootsEnv, err := cas.Host(roots, t.Getenv)
if err != nil {
return nil, err
}
return append(env, rootsEnv...), state.WriteFile(roots, bundle)
}
// trustCAs makes the client that downloads the host's mise trust the
// user's CAs (trust.Read) as well as this machine's own.
func (t Versions) trustCAs() error {
cas, err := trust.Read(t.Dirs.TrustedCAs())
if err != nil || len(cas) == 0 {
return err
}
pool, err := x509.SystemCertPool()
if err != nil {
return err
}
pool.AppendCertsFromPEM(cas.Bundle())
t.Client.Trust(pool)
return nil
}
// Resolve resolves shared-tools/mise.toml to the newest matching releases, for
// every platform VMs run, into out (and out.toml, the mise.toml it's
// from). Every tool, or nothing: offline, or with a tool mise can't
// resolve, it writes nothing and returns tools_resolve_failed, with the
// resolve, it writes nothing and returns tools_resolve_failed
// (tools_untrusted for a certificate mise doesn't trust), with the
// details in the run log. mise's version lists come from its versions
// host (no GitHub rate limit). It returns the lock it wrote.
func (t Versions) Resolve(ctx context.Context, out string) (Lock, error) {
@@ -160,16 +235,20 @@ func (t Versions) Resolve(ctx context.Context, out string) (Lock, error) {
return Lock{}, err
}
if err := t.LoggedCmd(ctx, msg.ResolvingTools(), cmd); err != nil {
return Lock{}, t.resolveFailed(ctx)
return Lock{}, t.resolveFailed(ctx, tmp)
}
lock, err := parseLockFile(filepath.Join(tmp, "mise.lock"))
if err != nil {
return Lock{}, t.resolveFailed(ctx)
return Lock{}, t.resolveFailed(ctx, tmp)
}
if lock, err = t.withSDKDownloads(ctx, lock); err != nil {
_, _ = fmt.Fprintln(t.LogWriter(), err)
return Lock{}, t.resolveFailed(ctx, tmp)
}
names, specs := configTools(config)
for _, n := range names {
if !lock.Has(n) {
return Lock{}, t.resolveFailed(ctx)
return Lock{}, t.resolveFailed(ctx, tmp)
}
}
if lock, err = t.stepBack(ctx, mise, lock, names, specs); err != nil {
@@ -181,10 +260,17 @@ func (t Versions) Resolve(ctx context.Context, out string) (Lock, error) {
return lock, state.WriteFile(out, lock.Bytes())
}
func (t Versions) resolveFailed(ctx context.Context) error {
// resolveFailed is the failure of mise's run in dir: tools_untrusted when
// its log says a server's certificate wasn't trusted, as on a network
// that inspects TLS, else tools_resolve_failed.
func (t Versions) resolveFailed(ctx context.Context, dir string) error {
if ctx.Err() != nil {
return ctx.Err()
}
log, err := os.ReadFile(filepath.Join(dir, miseLog)) //nolint:gosec // mise's log, in devvm's own folder
if err == nil && bytes.Contains(log, []byte(untrustedCert)) {
return backend.Logged(msg.ToolsUntrusted(t.Dirs.TrustedCAs()).Because(errUntrusted))
}
return backend.Logged(msg.ToolsResolveFailed())
}
@@ -203,9 +289,9 @@ func (t Versions) stepBack(ctx context.Context, mise string, lock Lock, names []
if lock.HasDownload(tool, t.platforms()) {
continue
}
v := lock.Version(tool)
older := t.olderVersions(ctx, mise, lock.Backend(tool), specs[tool], v)
one, c := t.olderWithDownload(ctx, mise, tool, older)
v, backendName := lock.Version(tool), lock.Backend(tool)
older := t.olderVersions(ctx, mise, backendName, specs[tool], v)
one, c := t.olderWithDownload(ctx, mise, tool, backendName, older)
if one == nil {
t.Warn(msg.ToolNoDownload(tool, v))
continue
@@ -227,8 +313,8 @@ func (t Versions) stepBack(ctx context.Context, mise string, lock Lock, names []
// olderWithDownload returns the entry of the newest of these older
// versions of a tool (newest first) that has a download for every
// platform, and its version: nil when none has.
func (t Versions) olderWithDownload(ctx context.Context, mise, tool string, older []string) (lockEntry, string) {
entries, ok := t.lockVersions(ctx, mise, tool, older)
func (t Versions) olderWithDownload(ctx context.Context, mise, tool, backendName string, older []string) (lockEntry, string) {
entries, ok := t.lockVersions(ctx, mise, tool, backendName, older)
if !ok {
return nil, ""
}
@@ -276,10 +362,11 @@ func (t Versions) olderVersions(ctx context.Context, mise, backendName, spec, v
}
// lockVersions locks these versions of a tool, all in one lock (mise
// takes a list of versions), in a folder of its own: mise also reads the
// mise.toml of the folders above. False when there are none, or mise
// fails.
func (t Versions) lockVersions(ctx context.Context, mise, tool string, versions []string) (Lock, bool) {
// takes a list of versions), from the backend its newest came from (the
// name mise's registry gives it may stand for another), in a folder of
// its own: mise also reads the mise.toml of the folders above. False when
// there are none, or mise fails.
func (t Versions) lockVersions(ctx context.Context, mise, tool, backendName string, versions []string) (Lock, bool) {
if len(versions) == 0 {
return Lock{}, false
}
@@ -289,7 +376,11 @@ func (t Versions) lockVersions(ctx context.Context, mise, tool string, versions
}
defer func() { _ = os.RemoveAll(dir) }()
list := `"` + strings.Join(versions, `","`) + `"`
if err := state.WriteFile(filepath.Join(dir, "mise.toml"), []byte("[tools]\n"+tool+" = ["+list+"]\n")); err != nil {
config := []byte("[tools]\n" + tool + " = [" + list + "]\n")
if backendName != "" {
config = append(append(aliasTable(map[string]string{tool: backendName}), '\n'), config...)
}
if err := state.WriteFile(filepath.Join(dir, "mise.toml"), config); err != nil {
return Lock{}, false
}
cmd, err := t.miseCmd(ctx, mise, dir, "lock", "--platform", strings.Join(t.platforms(), ","))
@@ -298,5 +389,8 @@ func (t Versions) lockVersions(ctx context.Context, mise, tool string, versions
}
_ = t.LoggedCmd(ctx, msg.ResolvingTools(), cmd) // what it locked is checked below
l, err := parseLockFile(filepath.Join(dir, "mise.lock"))
if err == nil {
l, err = t.withSDKDownloads(ctx, l)
}
return l, err == nil
}
+50
View File
@@ -3,6 +3,7 @@ package tools
import (
"crypto/sha256"
"encoding/hex"
"maps"
"os"
"regexp"
"slices"
@@ -68,3 +69,52 @@ func TestE2ELockPins(t *testing.T) {
}
}
}
// TestToolBackendsNamed checks that shared-tools/mise.toml's [tool_alias]
// names the backend of every shared tool that isn't one of mise's own
// (core:), and that it's the one tests/e2e-mise.lock resolved: mise's
// registry picks a tool's backend otherwise, and a mise release can move
// its pick (opencode 2's to npm, which has no download per platform).
func TestToolBackendsNamed(t *testing.T) {
config := read(t, repo(t, "assets", "shared-tools", "mise.toml"))
aliases, err := configAliases(config)
if err != nil {
t.Fatal(err)
}
lock := parsed(t, read(t, repo(t, "tests", "e2e-mise.lock")))
names, _ := configTools(config)
for _, tool := range names {
got, named := aliases[tool]
switch b := lock.Backend(tool); {
case b == "core:"+tool && !named:
case !named:
t.Errorf("mise.toml doesn't name %s's backend (the lock's is %s): add it to [tool_alias]", tool, b)
case got != b:
t.Errorf("mise.toml names %s's backend %s, tests/e2e-mise.lock has %s: run scripts/bump.sh e2e-tools", tool, got, b)
}
}
for tool := range aliases {
if !slices.Contains(names, tool) {
t.Errorf("mise.toml's [tool_alias] names %s, which isn't one of its [tools]", tool)
}
}
}
// Aliases gives a VM's mise the [tool_alias] table, a tool a line.
func TestAliases(t *testing.T) {
got, err := Aliases(os.DirFS(repo(t, "assets")))
if err != nil {
t.Fatal(err)
}
want, _ := configAliases(read(t, repo(t, "assets", "shared-tools", "mise.toml")))
back, err := configAliases(got)
if err != nil || !maps.Equal(back, want) || len(want) == 0 {
t.Errorf("Aliases = %q (%v), want %q", got, err, want)
}
if !strings.HasPrefix(string(got), "[tool_alias]\nclaude = \"aqua:anthropics/claude-code\"\n") {
t.Errorf("Aliases = %q", got)
}
if _, err := Aliases(os.DirFS(t.TempDir())); err == nil {
t.Error("no mise.toml, no error")
}
}
+2 -2
View File
@@ -88,9 +88,9 @@ func TestMiseCmdCompanyProxy(t *testing.T) {
if err != nil || slices.ContainsFunc(cmd.Env, func(kv string) bool { return strings.Contains(kv, "proxy.corp") }) {
t.Errorf("the environment's: %v, %q", err, cmd.Env)
}
// None: nothing added.
// None: nothing added to mise's own eight.
e.Proxy = nil
if cmd, err = e.miseCmd(t.Context(), "/bin/true", t.TempDir(), "lock"); err != nil || len(cmd.Env) != len(os.Environ())+7 {
if cmd, err = e.miseCmd(t.Context(), "/bin/true", t.TempDir(), "lock"); err != nil || len(cmd.Env) != len(os.Environ())+8 {
t.Errorf("none: %v, %d of %d", err, len(cmd.Env), len(os.Environ()))
}
}
+11 -1
View File
@@ -207,8 +207,18 @@ func (t Share) buildOne(ctx context.Context, b backend.Backend, base string, tg
if err != nil {
return err
}
args := []string{tool, version, file}
if image.OwnDownload(tool) {
// build.sh fetches it itself, from the lock's download for this
// VM's platform, checked against the lock's checksum.
url, sum := lock.Download(tool, t.platform(tg.Libc))
if !strings.HasPrefix(url, "https://") || !strings.HasPrefix(sum, "sha512:") {
return msg.ToolUnbuilt(tool, version)
}
args = append(args, url, strings.TrimPrefix(sum, "sha512:"))
}
spec := backend.ToolsSpec{
Name: Label([]string{file}), Base: base, Out: out, OutAt: ShareAt, Args: []string{tool, version, file}, Format: tg.Format,
Name: Label([]string{file}), Base: base, Out: out, OutAt: ShareAt, Args: args, Format: tg.Format,
Net: backend.NetInternet, Script: backend.Script{Name: "build.sh", Data: script}, Trust: ca,
}
if err := b.BuildTools(ctx, spec); err != nil {
+26 -3
View File
@@ -96,6 +96,9 @@ type Env struct {
// and platform) and checksums, by platform.
miseURL string
miseSums map[string]string
// dotnetURL is a .NET channel's releases.json (a format taking the
// channel), which the lock's dotnet downloads come from.
dotnetURL string
}
// Versions is the tools lock: resolving it with the host's mise, the daily
@@ -129,7 +132,7 @@ func New(d paths.Dirs, assets fs.FS, version string, r msg.Reporter, host platfo
t := &Env{
Dirs: d, Assets: assets, Self: self, Version: version, OS: runtime.GOOS, Arch: runtime.GOARCH,
Getenv: os.Getenv, Client: newClient(), RetryDelay: time.Second, Now: time.Now, Detach: daemon.Detach,
ShareNote: 3 * time.Second, miseURL: miseURL, miseSums: miseSHA256,
ShareNote: 3 * time.Second, miseURL: miseURL, miseSums: miseSHA256, dotnetURL: dotnetReleases,
Reporter: r, FreeSpace: host.FreeSpace,
}
// The environment it reads is Getenv's, and the Proxy the one at each
@@ -165,8 +168,26 @@ func (t *Env) platform(libc string) string {
return p
}
// configFile is devvm's mise.toml of the shared tools, in its assets.
const configFile = "shared-tools/mise.toml"
// config is devvm's shared-tools/mise.toml.
func (t *Env) config() ([]byte, error) { return fs.ReadFile(t.Assets, "shared-tools/mise.toml") }
func (t *Env) config() ([]byte, error) { return fs.ReadFile(t.Assets, configFile) }
// Aliases is the [tool_alias] table of devvm's shared-tools/mise.toml,
// each tool's backend, for a VM's mise config: the VM's mise then takes
// each tool from where its image's came from, whatever its registry says.
func Aliases(assets fs.FS) ([]byte, error) {
data, err := fs.ReadFile(assets, configFile)
if err != nil {
return nil, err
}
aliases, err := configAliases(data)
if err != nil {
return nil, err
}
return aliasTable(aliases), nil
}
// Lock returns the tools lock, resolving it first when there's none yet,
// it isn't TOML, or shared-tools/mise.toml changed since (a devvm
@@ -186,7 +207,9 @@ func (t Versions) Lock(ctx context.Context) (Lock, error) {
t.Info(msg.ResolvingTools())
lock, err := t.Resolve(ctx, t.Dirs.ToolLock())
if err != nil {
if _, ok := errors.AsType[*backend.LoggedError](err); ok {
// A certificate mise doesn't trust is said as it is: being online
// again doesn't help.
if _, ok := errors.AsType[*backend.LoggedError](err); ok && !errors.Is(err, errUntrusted) {
return Lock{}, backend.Logged(msg.ToolsNeedResolve())
}
return Lock{}, err
+10
View File
@@ -158,6 +158,8 @@ func newEnv(t *testing.T) env {
tl.Arch = "arm64"
tl.Getenv = func(string) string { return "" }
tl.Mise = stubtest.Command(t, "mise")
// Never Microsoft's: a test that needs dotnet's releases serves them.
tl.dotnetURL = "http://127.0.0.1:0/%s/releases.json"
tl.ShareNote = time.Millisecond
tl.RetryDelay = time.Millisecond
tl.FreeSpace = func(string) (uint64, error) { return 1 << 40, nil }
@@ -497,9 +499,16 @@ func TestRefreshStepsBack(t *testing.T) {
e.locked(t, fixture(t))
newer := newerLock(t)
e.stubLocks(t, newer, olderLock(t), "24.19.0 24.20.0 24.20.1 24.21.0.1 24.22.0")
config := filepath.Join(t.TempDir(), "older.toml")
t.Setenv("MISE_STUB_OLDER_CONFIG", config)
if err := e.Refresh(t.Context()); err != nil {
t.Fatal(msg.NamesOf(err))
}
// The older versions come from the backend the newest came from, which
// mise's registry might not give the tool's name.
if got, want := string(read(t, config)), "[tool_alias]\nnode = \"core:node\"\n\n[tools]\nnode = [\"24.20.1\",\"24.20.0\",\"24.19.0\"]\n"; got != want {
t.Errorf("the step back's mise.toml = %q, want %q", got, want)
}
if !slices.Contains(*e.said, "devvm: tool_stepped_back older=24.20.0 tool=node version=24.21.0.1") {
t.Errorf("said %q", *e.said)
}
@@ -1224,6 +1233,7 @@ func TestList(t *testing.T) {
"go go 1.27.2 true 0 current",
"go go 1.20.0 true 2 in use",
"go go 1.9.0 true 0 unused",
"dotnet false 0 not installed",
"claude claude 2.1.295 true 1 current",
"codex false 0 not installed",
"opencode false 0 not installed",
+133
View File
@@ -0,0 +1,133 @@
package trust
import (
"os"
"path/filepath"
"slices"
"strings"
"testing"
)
// Host: the host's bundle and the user's CAs in one, which SSL_CERT_FILE
// names; SSL_CERT_DIR names the host's folders of CAs only when the
// environment has neither variable (TestHostOwnBundle), so a program
// given its own SSL_CERT_FILE trusts no folder it didn't; nothing for no
// CAs.
func TestHost(t *testing.T) {
dir := t.TempDir()
own := filepath.Join(dir, "own.pem")
write(t, dir, "own.pem", []byte("the host's roots"))
ca := cert(t, "company", true)
cas, err := parse("company.pem", ca)
if err != nil {
t.Fatal(err)
}
path := filepath.Join(dir, "devvm-ca.pem")
cases := []struct {
name string
env map[string]string
cas CAs
wantBundle string
wantEnv []string // without SSL_CERT_DIR's host folders
hostDirs bool // SSL_CERT_DIR names the host's folders
}{
{name: "no CAs", env: map[string]string{"SSL_CERT_FILE": own}},
{
name: "SSL_CERT_FILE's bundle", env: map[string]string{"SSL_CERT_FILE": own, "SSL_CERT_DIR": dir}, cas: cas,
wantBundle: "the host's roots\n" + string(ca), wantEnv: []string{"SSL_CERT_FILE=" + path},
},
{
// Its SSL_CERT_FILE alone: the program read no folder, so it
// reads none still.
name: "no SSL_CERT_DIR", env: map[string]string{"SSL_CERT_FILE": own}, cas: cas,
wantBundle: "the host's roots\n" + string(ca), wantEnv: []string{"SSL_CERT_FILE=" + path},
},
{
name: "SSL_CERT_FILE missing", env: map[string]string{"SSL_CERT_FILE": filepath.Join(dir, "none"), "SSL_CERT_DIR": dir}, cas: cas,
wantBundle: string(ca), wantEnv: []string{"SSL_CERT_FILE=" + path},
},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
bundle, env, err := c.cas.Host(path, func(k string) string { return c.env[k] })
if err != nil {
t.Fatal(err)
}
if string(bundle) != c.wantBundle {
t.Errorf("bundle = %q, want %q", bundle, c.wantBundle)
}
var dirs []string
env = slices.DeleteFunc(env, func(kv string) bool {
v, ok := strings.CutPrefix(kv, "SSL_CERT_DIR=")
if ok {
dirs = strings.Split(v, ":")
}
return ok
})
if !slices.Equal(env, c.wantEnv) {
t.Errorf("env = %q, want %q", env, c.wantEnv)
}
var want []string
for _, d := range hostDirs() {
if fi, err := os.Stat(d); c.hostDirs && err == nil && fi.IsDir() {
want = append(want, d)
}
}
if !slices.Equal(dirs, want) {
t.Errorf("SSL_CERT_DIR = %q, want %q", dirs, want)
}
})
}
}
// Without SSL_CERT_FILE the host's bundle is the first of hostBundles
// there, and with neither variable SSL_CERT_DIR names the host's folders
// of CAs, which the program read; a bundle that can't be read fails it.
func TestHostOwnBundle(t *testing.T) {
cas, err := parse("company.pem", cert(t, "company", true))
if err != nil {
t.Fatal(err)
}
none := func(string) string { return "" }
bundle, env, err := cas.Host("/x/devvm-ca.pem", none)
if err != nil {
t.Fatal(err)
}
var dirs []string
for _, d := range hostDirs() {
if fi, err := os.Stat(d); err == nil && fi.IsDir() {
dirs = append(dirs, d)
}
}
want := []string{"SSL_CERT_FILE=/x/devvm-ca.pem"}
if len(dirs) > 0 {
want = append(want, "SSL_CERT_DIR="+strings.Join(dirs, ":"))
}
if !slices.Equal(env, want) {
t.Errorf("env = %q, want %q", env, want)
}
if first := firstThere(hostBundles()); first != "" {
own, err := os.ReadFile(first) //nolint:gosec // the host's bundle
if err != nil {
t.Fatal(err)
}
if !strings.HasPrefix(string(bundle), string(own)) {
t.Errorf("the bundle doesn't start with %s", first)
}
}
if !strings.HasSuffix(string(bundle), string(cas.Bundle())) {
t.Error("the bundle doesn't end with the CAs")
}
dir := t.TempDir()
if _, _, err := cas.Host("/x/devvm-ca.pem", func(k string) string {
if k == "SSL_CERT_FILE" {
return dir
}
return ""
}); err == nil {
t.Error("a folder for SSL_CERT_FILE read")
}
if firstThere([]string{filepath.Join(dir, "none"), dir}) != dir || firstThere(nil) != "" {
t.Error("firstThere")
}
}
+82 -3
View File
@@ -1,9 +1,10 @@
// Package trust is the user's own CAs, a company's for a proxy that
// inspects TLS: read from devvm's CA folder (paths.Dirs.TrustedCAs) and
// checked, then trusted in project VMs (sent at each launch, installed by
// guest/ca.sh), in build VMs while they build (never in the images), and
// by devvm's proxy for its own connections. It also makes each VM's own
// CA (InitCA), which the VM's proxy intercepts with.
// guest/ca.sh), in build VMs while they build (never in the images), by
// devvm's proxy for its own connections, and by devvm's mise on the host
// (internal/tools; on Linux with Host's bundle). It also makes each VM's
// own CA (InitCA), which the VM's proxy intercepts with.
package trust
import (
@@ -158,6 +159,84 @@ func parse(file string, data []byte) (CAs, error) {
// Bundle returns them all in one PEM file; nil for none.
func (c CAs) Bundle() []byte { return bytes.Join(c, nil) }
// Host returns what makes a program on a Linux host that reads its roots
// from files trust them as well as the host's own CAs, as devvm's mise
// does (rustls' native roots): a bundle of both, which the caller writes
// at path, and the environment that points the program at it. The host's
// bundle is the file SSL_CERT_FILE names when getenv has one, else the
// first of hostBundles that's there, and SSL_CERT_FILE then names path.
// Such a program reads the host's folders of CAs (hostDirs) only when
// neither SSL_CERT_FILE nor SSL_CERT_DIR is set, so then SSL_CERT_DIR
// names them. Otherwise it reads what getenv's name, as before: an
// SSL_CERT_DIR of getenv's stays, and an SSL_CERT_FILE alone gets no
// folder, so it trusts nothing it didn't. Nothing for no CAs.
func (c CAs) Host(path string, getenv func(string) string) (bundle []byte, env []string, err error) {
if len(c) == 0 {
return nil, nil, nil
}
own := getenv("SSL_CERT_FILE")
probe := own == "" && getenv("SSL_CERT_DIR") == ""
if own == "" {
own = firstThere(hostBundles())
}
if own != "" {
data, err := os.ReadFile(own) //nolint:gosec // the host's own CA bundle, as the program would read it
switch {
case err == nil:
bundle = append(bytes.TrimRight(data, "\n"), '\n')
case !errors.Is(err, fs.ErrNotExist):
return nil, nil, err
}
}
bundle = append(bundle, c.Bundle()...)
env = []string{"SSL_CERT_FILE=" + path}
if probe {
var dirs []string
for _, d := range hostDirs() {
if fi, err := os.Stat(d); err == nil && fi.IsDir() {
dirs = append(dirs, d)
}
}
if len(dirs) > 0 {
env = append(env, "SSL_CERT_DIR="+strings.Join(dirs, ":"))
}
}
return bundle, env, nil
}
// hostBundles are where a Linux host's CA bundle may be, in the order
// rustls' native roots look for it (openssl-probe's list): the first
// that's there is the host's.
func hostBundles() []string {
return []string{
"/etc/ssl/certs/ca-certificates.crt", // Debian, Ubuntu, Arch
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", // Fedora, RHEL
"/etc/pki/tls/certs/ca-bundle.crt",
"/etc/ssl/ca-bundle.pem", // openSUSE
"/etc/pki/tls/cacert.pem",
"/etc/ssl/cert.pem", // Alpine
"/opt/etc/ssl/certs/ca-certificates.crt",
"/etc/ssl/certs/cacert.pem",
}
}
// hostDirs are the folders of a Linux host's CAs, a file each, that
// rustls' native roots read besides its bundle (openssl-probe's list).
func hostDirs() []string {
return []string{"/etc/ssl/certs", "/etc/pki/tls/certs", "/etc/security/certificates"}
}
// firstThere is the first of paths that's there, followed if a link; ""
// for none.
func firstThere(paths []string) string {
for _, p := range paths {
if _, err := os.Stat(p); err == nil {
return p
}
}
return ""
}
// Name is the file the i-th one (from 0) is installed as in a VM.
func Name(i int) string { return "devvm-extra-" + strconv.Itoa(i+1) + ".crt" }
+3 -2
View File
@@ -26,11 +26,12 @@ type Known struct {
}
// ReadKnown reads the record at path. A missing or unreadable one is
// none: the next check writes it again.
// none, as is one naming a prerelease, which is never announced: the
// next check writes it again.
func ReadKnown(path string) Known {
var k Known
data, err := os.ReadFile(path) //nolint:gosec // paths come from paths.Dirs
if err != nil || json.Unmarshal(data, &k) != nil || (k.Latest != "" && !Valid(k.Latest)) {
if err != nil || json.Unmarshal(data, &k) != nil || (k.Latest != "" && (!Valid(k.Latest) || Prerelease(k.Latest))) {
return Known{}
}
return k
+3 -1
View File
@@ -36,6 +36,8 @@ func TestKnown(t *testing.T) {
{"0.2.0", "0.3.0", false},
{"", "0.1.0", false},
{"0.2.0", "", false},
{"0.2.0", "0.2.0-rc.1", true},
{"0.1.0", "0.2.0-rc.1", false},
} {
if got := (upgrade.Known{Latest: c.latest}).Newer(c.current); got != c.newer {
t.Errorf("%q over %q: %v", c.latest, c.current, got)
@@ -70,7 +72,7 @@ func TestRefresh(t *testing.T) {
if k := upgrade.ReadKnown(path); k.Latest != "0.2.0" || !k.Checked.Equal(first) || !k.Tried.Equal(next) {
t.Fatalf("offline: %+v", k)
}
for _, bad := range []string{"{", `{"latest":"v1; rm"}`} {
for _, bad := range []string{"{", `{"latest":"v1; rm"}`, `{"latest":"0.3.0-rc.1"}`} {
if err := os.WriteFile(path, []byte(bad), 0o600); err != nil {
t.Fatal(err)
}
+6 -1
View File
@@ -50,7 +50,9 @@ func NewSource(url, key string) Source {
// Latest returns the newest release's version, from where the
// repository's releases/latest goes, as install.sh reads it: no API, so
// no rate limit.
// no rate limit. GitHub's releases/latest skips prereleases, and a
// prerelease there anyway is refused, so it's never installed or
// announced as the newest release.
func (s Source) Latest(ctx context.Context) (string, error) {
end, err := fetch.Resolve(ctx, s.Client, s.URL+"/releases/latest")
if err != nil {
@@ -60,6 +62,9 @@ func (s Source) Latest(ctx context.Context) (string, error) {
if !ok || !Valid(v) {
return "", msg.UpgradeNoLatest(s.URL)
}
if Prerelease(v) {
return "", msg.UpgradeNoLatest(s.URL).Because(errors.New("releases/latest is the prerelease " + v))
}
return v, nil
}
+9 -3
View File
@@ -64,9 +64,11 @@ type Options struct {
}
// Upgrade installs the newest release, or o.Version, over this devvm, as
// it was installed, once it's asked. It refuses a newest release older
// than this devvm, as a server sending an old release would, unless
// o.Version names it.
// it was installed, once it's asked. The newest release is never a
// prerelease (Latest), so only o.Version installs one. It refuses a
// newest release older than this devvm, as a server sending an old
// release would, unless o.Version names it; for a prerelease of a
// release not yet out, that's no failure, only said.
func (u Upgrader) Upgrade(ctx context.Context, o Options) error {
if u.Install.Kind == Other || !Valid(u.Current) {
return u.NotInstalled()
@@ -92,6 +94,10 @@ func (u Upgrader) Upgrade(ctx context.Context, o Options) error {
case c == 0:
u.Info(msg.UpgradeAlreadyLatest(u.Current))
return nil
case c < 0 && o.Version == "" && Prerelease(u.Current):
// A prerelease of the next release, before that release is out.
u.Info(msg.UpgradePrereleaseAhead(u.Current, target))
return nil
case c < 0 && o.Version == "":
return msg.UpgradeLatestOlder(u.Current, target)
}
+62 -1
View File
@@ -524,20 +524,81 @@ func TestCompare(t *testing.T) {
{"1.0.0-1", "1.0.0-alpha", -1},
{"1.0.0-alpha", "1.0.0-alpha.1", -1},
{"1.0.0-beta", "1.0.0-alpha", 1},
{"0.2.0-beta.3", "0.2.0-rc.1", -1},
{"0.2.0-alpha.1", "0.2.0-beta.1", -1},
{"0.2.0-rc.2", "0.2.0-rc.1", 1},
{"0.2.0-rc.1", "0.1.0", 1},
{"0.2.0-rc.1", "0.2.1-alpha.1", -1},
{"0.2.0-rc.1", "0.2.0-rc.1", 0},
{"99999999999999999999.0.0", "18446744073709551615.0.0", 1},
{"01.0.0", "1.0.0", 0},
} {
if got := upgrade.Compare(tc.a, tc.b); got != tc.want {
t.Errorf("Compare(%s, %s) = %d", tc.a, tc.b, got)
}
if got := upgrade.Compare(tc.b, tc.a); got != -tc.want {
t.Errorf("Compare(%s, %s) = %d", tc.b, tc.a, got)
}
}
for v, valid := range map[string]bool{
"0.1.0": true, "1.2.3-rc.1": true, "v0.1.0": false, "0.1": false, "0.1.0/../x": false, "": false, "(devel)": false,
"0.1.0": true, "1.2.3-rc.1": true, "0.2.0-beta.2": true, "v0.1.0": false, "0.1": false, "0.1.0/../x": false,
"": false, "(devel)": false, "0.1.0-rc/1": false,
} {
if upgrade.Valid(v) != valid {
t.Errorf("Valid(%q) = %v", v, !valid)
}
}
for v, pre := range map[string]bool{
"0.2.0": false, "0.2.0-rc.1": true, "0.2.0-beta.3": true, "0.2.0-alpha.1": true, "": false, "(devel)": false,
"0.0.0-20261106-abcdef": false,
} {
if upgrade.Prerelease(v) != pre {
t.Errorf("Prerelease(%q) = %v", v, !pre)
}
}
}
// A prerelease is never the newest release: one at releases/latest is
// refused, so only --to installs one.
func TestLatestIsNoPrerelease(t *testing.T) {
f := newFixture(t, "0.1.0")
f.release("0.2.0-rc.1", true)
if _, err := f.upgrader().Source.Latest(t.Context()); msg.IDOf(err) != "upgrade_no_latest" {
t.Errorf("Latest = %v", err)
}
if err := f.upgrader().Upgrade(t.Context(), upgrade.Options{Force: true}); msg.IDOf(err) != "upgrade_no_latest" {
t.Errorf("Upgrade = %v", err)
}
f.unchanged()
if err := f.upgrader().Upgrade(t.Context(), upgrade.Options{Version: "0.2.0-rc.1", Force: true}); err != nil {
t.Fatal(err)
}
if got := f.linked(); got != "0.2.0-rc.1" {
t.Errorf("the link points at %s", got)
}
}
// On a prerelease of a release that isn't out, the older newest release
// is said, not a failure, and nothing is installed; once the release is
// out, it's installed over the prerelease.
func TestUpgradeFromPrerelease(t *testing.T) {
f := newFixture(t, "0.2.0-rc.1")
f.release("0.1.0", true)
if err := f.upgrader().Upgrade(t.Context(), upgrade.Options{Force: true}); err != nil {
t.Fatal(err)
}
f.unchanged()
if got := f.infos.Names(); !slices.Equal(got, []string{"upgrade_prerelease_ahead current=0.2.0-rc.1 latest=0.1.0"}) {
t.Errorf("said %q", got)
}
f.release("0.2.0-rc.2", false)
f.release("0.2.0", true)
if err := f.upgrader().Upgrade(t.Context(), upgrade.Options{Force: true}); err != nil {
t.Fatal(err)
}
if got := f.linked(); got != "0.2.0" {
t.Errorf("the link points at %s", got)
}
}
// runVersion runs path --version.
+6
View File
@@ -14,6 +14,12 @@ var releaseVersion = regexp.MustCompile(`^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)
// Valid reports whether v is a release's version.
func Valid(v string) bool { return releaseVersion.MatchString(v) }
// Prerelease reports whether v is a prerelease's version, such as
// 0.2.0-rc.1: one with a -suffix, which GitHub marks as a prerelease, so
// its releases/latest skips it, as the newest release's lookup and the
// daily check do too. Only devvm upgrade --to installs one.
func Prerelease(v string) bool { return Valid(v) && strings.Contains(v, "-") }
// Compare compares two release versions (Valid) as semver orders them:
// numbers as numbers, a version with a -suffix before the same one
// without, and suffixes part by part, numbers below words (rc.9 before
+38 -7
View File
@@ -3,6 +3,7 @@ package vm
import (
"io"
"os"
"path"
"path/filepath"
"strings"
@@ -60,14 +61,9 @@ type detected struct{ Name, File string }
// default parts (defaults) start from them.
func detectFiles(dir string) []detected {
var found []detected
f := folder{dir: dir}
for _, m := range markers() {
file := ""
for _, f := range m.files {
if _, err := os.Lstat(filepath.Join(dir, f)); err == nil {
file = f
break
}
}
file := f.first(m.files)
if file == "" && m.part == image.NixLayer && nixShell(dir) {
file = "default.nix"
}
@@ -77,3 +73,38 @@ func detectFiles(dir string) []detected {
}
return found
}
// folder is a project folder's top level, as detectFiles looks in it:
// its names are read once, for the first pattern that needs them.
type folder struct {
dir string
names []string
read bool
}
// first is the first of a marker's files in the folder: a name that's
// there, or the first name a pattern matches (path.Match's), in name
// order; "" when none is.
func (f *folder) first(files []string) string {
for _, file := range files {
if !strings.Contains(file, "*") {
if _, err := os.Lstat(filepath.Join(f.dir, file)); err == nil {
return file
}
continue
}
if !f.read {
entries, _ := os.ReadDir(f.dir) // sorted by name; none when it can't be read
for _, e := range entries {
f.names = append(f.names, e.Name())
}
f.read = true
}
for _, n := range f.names {
if ok, _ := path.Match(file, n); ok {
return n
}
}
}
return ""
}
+30
View File
@@ -39,6 +39,11 @@ func TestDetect(t *testing.T) {
{"Pipfile", "python"},
{"Cargo.toml", "rust"},
{"go.mod", "go"},
{"App.sln", "dotnet"},
{"App.slnx", "dotnet"},
{"App.csproj", "dotnet"},
{"Lib.fsproj", "dotnet"},
{"global.json", "dotnet"},
{"flake.nix", "nix"},
{"shell.nix", "nix"},
{"devenv.nix", "nix"},
@@ -72,6 +77,31 @@ func TestDetect(t *testing.T) {
}
}
// A pattern names the file it matched: the first, in name order, of the
// first pattern that matches, before the names after it; only the top
// level counts, and a name that only looks like it doesn't.
func TestDetectPatterns(t *testing.T) {
d := t.TempDir()
if err := os.MkdirAll(filepath.Join(d, "src"), 0o700); err != nil {
t.Fatal(err)
}
touchAll(t, filepath.Join(d, "src", "App.csproj"), filepath.Join(d, "App.csproj.user"), filepath.Join(d, "global.json.bak"))
if got := detect(d); got != nil {
t.Errorf("detect with src/App.csproj, App.csproj.user and global.json.bak = %v", got)
}
touchAll(t, filepath.Join(d, "global.json"), filepath.Join(d, "Web.csproj"), filepath.Join(d, "Api.csproj"))
if got, want := detectFiles(d), []detected{{"dotnet", "Api.csproj"}}; !slices.Equal(got, want) {
t.Errorf("detectFiles = %v, want %v", got, want)
}
touchAll(t, filepath.Join(d, "Shop.sln"))
if got, want := detectFiles(d), []detected{{"dotnet", "Shop.sln"}}; !slices.Equal(got, want) {
t.Errorf("detectFiles with Shop.sln = %v, want %v", got, want)
}
if got := detectFiles(filepath.Join(d, "none")); got != nil {
t.Errorf("detectFiles of a missing folder = %v", got)
}
}
// A default.nix calls for nix only when it makes a shell, and only as a
// regular file.
func TestDetectDefaultNix(t *testing.T) {
+5
View File
@@ -269,6 +269,11 @@ func (e syncer) stage(ctx context.Context, st *state.VM, in setupInputs) (*stage
s.put("ca/"+trust.Name(i), 0o644, c)
}
s.put("tools", 0o644, tools.Mounts(files))
aliases, err := tools.Aliases(e.Assets)
if err != nil {
return nil, err
}
s.put("tool-alias.toml", 0o644, aliases)
// The host's settings, for every VM.
lang := e.Getenv("LC_ALL")
+6 -1
View File
@@ -45,9 +45,14 @@ func TestUp(t *testing.T) {
if spec.Tools != e.Dirs.Tools() || spec.ToolsAt != tools.ShareAt {
t.Errorf("CreateVM's tools share = %q at %q", spec.Tools, spec.ToolsAt)
}
if got := staged(t, f); got["tools"] != "" || !strings.HasPrefix(got["sync.sh"], "#!/bin/bash") || got["tools.sh"] == "" {
got := staged(t, f)
if got["tools"] != "" || !strings.HasPrefix(got["sync.sh"], "#!/bin/bash") || got["tools.sh"] == "" {
t.Errorf("staged = %q", got)
}
// The backends each tool's image comes from, for the VM's mise.
if want, err := tools.Aliases(e.Assets); err != nil || got["tool-alias.toml"] != string(want) || !strings.HasPrefix(string(want), "[tool_alias]\n") {
t.Errorf("staged tool-alias.toml = %q, want %q (%v)", got["tool-alias.toml"], want, err)
}
if len(*execs) != 1 || (*execs)[0].Path != "/bin/shell" {
t.Errorf("exec = %+v", *execs)
}
+8 -1
View File
@@ -2123,6 +2123,9 @@ other = "Resolving the shared tools' versions failed. Check that you're online."
[tools_need_resolve]
other = "Resolving the shared tools' versions failed, and devvm has to do it once, online. Try again when you're online."
[tools_untrusted]
other = "Resolving the shared tools' versions failed because this machine doesn't trust a server's certificate. A network that inspects TLS needs its CA in this machine's store, or on Linux in {{.dir}}."
[tool_not_locked]
other = "The tools lock {{.lock}} has no version of {{.tool}}. Run devvm tools update to resolve the shared tools again."
@@ -2672,6 +2675,10 @@ other = "This is devvm {{.version}} already, so nothing was installed."
description = "current is this devvm's version, latest the release server's newest, which is older"
other = "The newest release, devvm {{.latest}}, is older than this devvm {{.current}}, so devvm upgrade installs nothing. To install it anyway, run devvm upgrade --to {{.latest}}."
[upgrade_prerelease_ahead]
description = "current is this devvm's version, a prerelease such as 0.2.0-rc.1; latest the newest release, which is older, such as 0.1.0"
other = "This is devvm {{.current}}, a prerelease newer than the newest release, devvm {{.latest}}, so nothing was installed. To go back to that release, run devvm upgrade --to {{.latest}}."
[upgrade_confirm]
other = "Install devvm {{.version}} in place of devvm {{.current}}?"
@@ -2743,7 +2750,7 @@ other = "Homebrew's brew upgrade devvm failed, so its devvm stays as it was."
other = "Homebrew upgraded devvm."
[upgrade_not_version]
other = "--to takes a release's version, such as 0.2.0, not {{.value}}."
other = "--to takes a release's version, such as 0.2.0 or 0.2.0-rc.1, not {{.value}}."
[upgrade_failed_reason]
description = "reason is an error from the system, in English"
+27 -8
View File
@@ -1,19 +1,38 @@
# The formula for the devvmhq/homebrew-tap repo. scripts/release.sh fills in @URL@ and @SHA256@ and writes
# the result to dist/devvm.rb. Homebrew reads the version from the URL (devvm-<version>.tar.gz).
# The formula for the devvmhq/homebrew-tap repo. scripts/release.sh fills in each platform's
# @URL_<OS>_<ARCH>@ and @SHA256_<OS>_<ARCH>@ from the release's SHA256SUMS, and writes the result to
# dist/devvm.rb. It installs the release's binary, which SHA256SUMS.minisig signs. Homebrew reads the
# version from the URLs (devvm-<version>-<os>-<arch>.tar.gz).
class Devvm < Formula
desc "Isolated Lima VM per project folder, with shared read-only toolchains"
homepage "https://github.com/devvmhq/devvm"
url "@URL@"
sha256 "@SHA256@"
license "MIT"
depends_on "go" => :build
depends_on "lima"
on_macos do
on_arm do
url "@URL_DARWIN_ARM64@"
sha256 "@SHA256_DARWIN_ARM64@"
end
on_intel do
url "@URL_DARWIN_AMD64@"
sha256 "@SHA256_DARWIN_AMD64@"
end
end
on_linux do
on_arm do
url "@URL_LINUX_ARM64@"
sha256 "@SHA256_LINUX_ARM64@"
end
on_intel do
url "@URL_LINUX_AMD64@"
sha256 "@SHA256_LINUX_AMD64@"
end
end
def install
ENV["CGO_ENABLED"] = "0"
ldflags = "-s -w -X github.com/devvmhq/devvm/internal/cli.version=#{version}"
system "go", "build", *std_go_args(ldflags:), "./cmd/devvm"
bin.install "devvm"
end
test do
+72 -9
View File
@@ -2,14 +2,15 @@
# Update the versions and checksums pinned in assets/ (layers/base.sh, layers/docker.sh, layers/nix.sh, features/*.sh,
# shared-tools/build.sh, oci/build.sh) and internal/tools/mise.go (devvm's host mise), and the
# end-to-end tests' own pins (tests/e2e-mise.lock, the --from images' digests in tests/e2e/from_test.go,
# and Ubuntu's cloud image release in tests/e2e/sandbox_test.go).
# Ubuntu's cloud image release in tests/e2e/sandbox_test.go, and CI's Lima in .github/workflows/e2e.yml).
# scripts/bump.sh --check show current and latest for every pin; change nothing
# scripts/bump.sh [tool...] update the given tools (default: all) and print a summary
# Tools: docker nix direnv nix-direnv mise rustup crane omb eza tealdeer e2e-tools e2e-from e2e-ubuntu
# Tools: docker nix direnv nix-direnv mise rustup crane omb eza tealdeer e2e-tools e2e-from e2e-ubuntu e2e-lima
# mise: base's, and the one devvm runs on the host to resolve the shared tools' versions
# e2e-tools: the shared tools' versions every e2e section but tools uses
# e2e-from: the container images e2e's --from checks start from, by digest
# e2e-ubuntu: the dated release of Ubuntu's cloud image e2e pins base to
# e2e-lima: the Lima release CI's e2e workflow installs, and its tarball's checksum
# The shared tools themselves (node, claude, ...) and Ubuntu's cloud image aren't pinned for users:
# devvm resolves them per user. Only e2e pins them, so its cached images stay valid between runs.
# Needs curl and jq. Checksums come from upstream's published sums where there are
@@ -18,7 +19,7 @@
# `devvm gc`.
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
all="docker nix direnv nix-direnv mise rustup crane omb eza tealdeer e2e-tools e2e-from e2e-ubuntu"
all="docker nix direnv nix-direnv mise rustup crane omb eza tealdeer e2e-tools e2e-from e2e-ubuntu e2e-lima"
check=false
if [[ ${1:-} == --check ]]; then check=true; shift; fi
@@ -43,6 +44,8 @@ sha_of() { fetch -o "$tmp/dl" "$1"; sha256 "$tmp/dl"; rm -f "$tmp/dl"; }
# `"VAR": "…",`.
get() { sed -n "s/^$2=\([^ ]*\).*/\1/p" "$root/$1"; }
get_const() { sed -n "s/^const $2 = \"\(.*\)\"$/\1/p" "$root/$1"; }
# get_env FILE VAR: the value of an indented `VAR: value` line in a workflow.
get_env() { sed -n "s/^ *$2: \([^ ]*\)$/\1/p" "$root/$1"; }
# valid VAR VALUE: VALUE comes from upstream and lands in a script that runs (some on the host), so
# only the shape a pin can have: a checksum, a commit, an image digest, a date or a version.
# Else exit.
@@ -51,7 +54,7 @@ valid() {
case $1 in
*_sha256*) re='^[0-9a-f]{64}$' ;;
*_commit) re='^[0-9a-f]{40}$' ;;
*_digest) re='^sha256:[0-9a-f]{64}$' ;;
*_digest | *Digest) re='^sha256:[0-9a-f]{64}$' ;;
*_release) re='^release-[0-9]{8}$' ;;
*_built) re='^[0-9]{8}T[0-9]{6}Z$' ;;
esac
@@ -74,6 +77,11 @@ write_staged() {
$0 = substr($0, 1, b) ENVIRON["V"] substr($0, e)
}
{ print }' "$root/${staged[i]}" > "$tmp/edit"
elif [[ ${staged[i]} == *.yml ]]; then
N=${staged[i + 1]} V=${staged[i + 2]} awk '
{ l = $0; sub(/^[ \t]*/, "", l) }
index(l, ENVIRON["N"] ": ") == 1 { $0 = substr($0, 1, length($0) - length(l)) ENVIRON["N"] ": " ENVIRON["V"] }
{ print }' "$root/${staged[i]}" > "$tmp/edit"
else
N=${staged[i + 1]} V=${staged[i + 2]} awk 'index($0, ENVIRON["N"] "=") == 1 { s = index($0, " "); $0 = ENVIRON["N"] "=" ENVIRON["V"] (s ? substr($0, s) : "") } { print }' \
"$root/${staged[i]}" > "$tmp/edit"
@@ -86,7 +94,15 @@ write_staged() {
report() {
if [[ $2 == "$3" ]]; then printf ' %-9s %-14s up to date\n' "$1" "$2"; return 1; fi
# The latest comes from upstream: no control characters on the terminal.
printf ' %-9s %-14s -> %s\n' "$1" "$2" "$(LC_ALL=C tr -d '\000-\037\177' <<<"$3")"
local shown
shown=$(LC_ALL=C tr -d '\000-\037\177' <<<"$3")
# Upstream's latest can lag behind a pin (a release marker not yet moved): an older version is
# never offered.
local ver='^v?[0-9]+(\.[0-9]+)*$'
if [[ $2 =~ $ver && $3 =~ $ver && $(printf '%s\n%s\n' "${2#v}" "${3#v}" | sort -V | head -1) == "${3#v}" ]]; then
printf " %-9s %-14s newer than upstream's latest, %s\n" "$1" "$2" "$shown"; return 1
fi
printf ' %-9s %-14s -> %s\n' "$1" "$2" "$shown"
$check && return 1
summary+=("$1: $2 -> $3")
}
@@ -107,6 +123,23 @@ bump_e2e-ubuntu() {
if report e2e-ubuntu "$(get_const $f e2eUbuntuRelease)" "$new"; then set_var $f e2eUbuntuRelease "$new" e2e_ubuntu_release; fi
}
# The Lima release CI's e2e workflow installs (.github/workflows/e2e.yml's LIMA_VERSION), and its
# Linux x86_64 tarball's line in the release's SHA256SUMS (LIMA_SHA256). Lima's release notes print
# SHA256SUMS's own SHA-256, so the file is checked against them before a line of it is used.
bump_e2e-lima() {
local f=.github/workflows/e2e.yml new want got
fetch https://api.github.com/repos/lima-vm/lima/releases/latest > "$tmp/lima-release"
new=$(jq -r .tag_name "$tmp/lima-release"); new=${new#v}
report e2e-lima "$(get_env $f LIMA_VERSION)" "$new" || return 0
valid lima_version "$new"
want=$(jq -r .body "$tmp/lima-release" | sed -n 's/.*sha256sum of the SHA256SUMS file itself is `\([0-9a-f]\{64\}\)`.*/\1/p' | head -1)
fetch -o "$tmp/lima-sums" "https://github.com/lima-vm/lima/releases/download/v$new/SHA256SUMS"
got=$(sha256 "$tmp/lima-sums")
[[ -n $want && $got == "$want" ]] || { echo "bump: Lima $new's SHA256SUMS doesn't match its release notes' sha256" >&2; exit 1; }
set_var $f LIMA_VERSION "$new" lima_version
set_var $f LIMA_SHA256 "$(awk -v n="lima-$new-Linux-x86_64.tar.gz" '$2 == n { print $1 }' "$tmp/lima-sums")" lima_sha256
}
# Docker's packages: the newest of each in its repository for base's Ubuntu release, and its signing key.
bump_docker() {
local f=assets/layers/docker.sh idx p var new sha
@@ -230,18 +263,46 @@ bump_omb() {
lock_version() {
awk -v t="[[tools.$2]]" '$0 == t { f = 1; next } f && /^version = / { gsub(/"/, "", $3); print $3; exit }' "$1" 2>/dev/null || true
}
# lock_checksum LOCK TOOL PLATFORM: the tool's download for PLATFORM has a SHA-256 in the lock.
# lock_checksum LOCK TOOL PLATFORM: the tool's download for PLATFORM has a SHA-256 in the lock, or
# for dotnet the SHA-512 Microsoft publishes.
lock_checksum() {
awk -v h="[tools.$2.\"platforms.$3\"]" '
$0 == h { f = 1; next }
f { ok = $0 ~ /^checksum = "sha256:[0-9a-f]+"$/ && length($0) == 84; exit }
f { ok = ($0 ~ /^checksum = "sha256:[0-9a-f]+"$/ && length($0) == 84) || ($0 ~ /^checksum = "sha512:[0-9a-f]+"$/ && length($0) == 148); exit }
END { exit !ok }' "$1"
}
# dotnet_downloads LOCK PLATFORM...: the lock's dotnet entry, which mise locks without a download,
# gets Microsoft's SDK archive for each platform and its SHA-512, from the channel's releases.json,
# as devvm adds them when it resolves the lock (internal/tools/dotnet.go). Exits when Microsoft has
# none for a platform yet.
dotnet_downloads() {
local lock=$1 v ch p rid url hash tables=""
shift
v=$(lock_version "$lock" dotnet)
[[ $v =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { printf 'bump: mise locked dotnet at an unexpected version: %q\n' "$v" >&2; exit 1; }
ch=${v%.*}
fetch -o "$tmp/dotnet-releases.json" "https://builds.dotnet.microsoft.com/dotnet/release-metadata/$ch/releases.json"
for p in "$@"; do
case $p in *-musl) rid=${p%-musl}; rid=linux-musl-${rid#linux-} ;; *) rid=$p ;; esac
read -r url hash < <(jq -r --arg v "$v" --arg rid "$rid" '[.releases[] | (.sdk // empty), (.sdks // [])[]
| select(.version == $v) | .files[] | select(.rid == $rid and .name == "dotnet-sdk-\($rid).tar.gz")][0]
| "\(.url) \(.hash)"' "$tmp/dotnet-releases.json")
hash=$(tr 'A-F' 'a-f' <<<"$hash")
if [[ $url != https://builds.dotnet.microsoft.com/dotnet/*.tar.gz || ! $hash =~ ^[0-9a-f]{128}$ ]]; then
echo "bump: dotnet $v has no SDK archive with a SHA-512 for $p yet: try again later" >&2; exit 1
fi
tables+=$'\n'"[tools.dotnet.\"platforms.$p\"]"$'\n'"checksum = \"sha512:$hash\""$'\n'"url = \"$url\""$'\n'
done
T=$tables awk '{ print } $0 == "[[tools.dotnet]]" { f = 1 } f && /^specifiers = / { printf "%s", ENVIRON["T"]; f = 0 }' \
"$lock" > "$tmp/dotnet.lock"
cat "$tmp/dotnet.lock" > "$lock"
}
# The shared tools' versions every e2e section but tools uses (tests/e2e-mise.lock): upstream's newest,
# resolved as devvm resolves them (its pinned host mise, mise lock on assets/shared-tools/mise.toml), for
# both architectures' glibc and musl VMs. Every tool must be in it, and each one's downloads but rust's
# (rustup checks its own) need a SHA-256 on every platform, or this exits: a release without its files
# both architectures' glibc and musl VMs, with dotnet's downloads added as devvm adds them. Every tool
# must be in it, and each one's downloads but rust's (rustup checks its own) need a SHA-256 (dotnet's a
# SHA-512) on every platform, or this exits: a release without its files
# yet, to try again later. Its first line is the SHA-256 of the mise.toml it was resolved from, which
# e2e checks before it runs.
e2e_lock=""
@@ -264,6 +325,8 @@ bump_e2e-tools() {
"$tmp/mise" lock --platform "$(tr ' ' ',' <<<"$platforms")") >"$tmp/mise-lock.log" 2>&1; then
cat "$tmp/mise-lock.log" >&2; echo "bump: mise lock failed" >&2; exit 1
fi
# shellcheck disable=SC2086 # the platforms, a word each
dotnet_downloads "$d/mise.lock" $platforms
while read -r tool; do
new=$(lock_version "$d/mise.lock" "$tool")
valid "${tool}_version" "$new"
+60 -25
View File
@@ -9,6 +9,9 @@
# the source tarball, SHA256SUMS, SHA256SUMS.minisig and install.sh, its notes CHANGELOG.md's entry, then
# commits dist/devvm.rb to the tap's Formula/devvm.rb and pushes the tap. Each step skips what's already
# done, so after a failure, fix it and run it again.
# A prerelease (VERSION x.y.z-rc.N, such as 0.2.0-rc.1) gets a GitHub release marked as a prerelease, which
# GitHub's latest release, and so install.sh's default and devvm upgrade, skips, and no tap commit: the tap,
# and so Homebrew, stays on the last release, and no tap checkout is needed.
# DEVVM_TAP_DIR: the checkout of devvmhq/homebrew-tap, clean and on main (default ../homebrew-tap, next to
# this repo). DEVVM_MINISIGN_KEY: the release key (scripts/release.sh's).
# Needs gh, logged in (gh auth login), and release.sh's goreleaser and minisign: mise exec -- scripts/publish.sh.
@@ -30,6 +33,9 @@ done
v=$(tr -d '[:space:]' < VERSION)
tag=v$v
# A prerelease's version has a -suffix (release.sh checks its form): its release is marked as one.
pre=false pre_flag=()
if [[ $v == *-* ]]; then pre=true pre_flag=(--prerelease); fi
# remote_ref DIR REF: the object REF names on DIR's origin, "" when it has none.
remote_ref() {
local out
@@ -63,31 +69,40 @@ for os in darwin linux; do
done
files+=("devvm-$v.tar.gz" SHA256SUMS SHA256SUMS.minisig install.sh)
# The release: none yet, a draft (a run that stopped while uploading: its files are replaced), or
# published (a run that stopped later: it needs every file).
# published (a run that stopped later: it needs every file, and to be a prerelease just when this is one).
release=none
if out=$(gh release view "$tag" --repo "$repo" --json isDraft,assets --jq '(.isDraft | tostring), .assets[].name' 2>&1); then
if out=$(gh release view "$tag" --repo "$repo" --json isDraft,isPrerelease,assets --jq '(.isDraft | tostring), (.isPrerelease | tostring), .assets[].name' 2>&1); then
release=published
[[ $(head -n1 <<<"$out") != true ]] || release=draft
if [[ $release == published ]]; then
for f in "${files[@]}"; do
tail -n +2 <<<"$out" | grep -qxF "$f" ||
tail -n +3 <<<"$out" | grep -qxF "$f" ||
die "devvm $tag already has a GitHub release, without $f: finish it or delete it by hand (gh release view $tag --repo $repo)"
done
marked=$(sed -n 2p <<<"$out")
if $pre && [[ $marked != true ]]; then
die "devvm $tag is a prerelease, but its GitHub release isn't marked as one: mark it by hand (gh release edit $tag --repo $repo --prerelease)"
elif ! $pre && [[ $marked == true ]]; then
die "devvm $tag's GitHub release is marked as a prerelease: unmark it by hand (gh release edit $tag --repo $repo --prerelease=false)"
fi
fi
elif ! grep -qi 'not found' <<<"$out"; then
die "can't read the GitHub release $tag (gh release view): $out"
fi
# The tap, which a prerelease leaves alone.
tap=${DEVVM_TAP_DIR:-$(dirname "$root")/homebrew-tap}
[[ -d $tap ]] && top=$(git -C "$tap" rev-parse --show-toplevel 2>/dev/null) && [[ $top == "$(cd "$tap" && pwd -P)" ]] ||
die "no tap checkout at $tap: clone devvmhq/homebrew-tap there, or set DEVVM_TAP_DIR"
[[ $(git -C "$tap" symbolic-ref -q --short HEAD) == main ]] || die "the tap at $tap isn't on main"
[[ -z $(git -C "$tap" status --porcelain) ]] || die "the tap at $tap isn't clean: commit or remove what git status lists"
tap_origin=$(remote_ref "$tap" refs/heads/main) || die "can't read the tap's origin (git -C $tap ls-remote origin)"
tap_head=$(git -C "$tap" rev-parse HEAD)
if [[ -n $tap_origin && $tap_origin != "$tap_head" ]]; then
git -C "$tap" merge-base --is-ancestor "$tap_origin" "$tap_head" 2>/dev/null ||
die "the tap's origin has commits its main lacks: git -C $tap pull"
if ! $pre; then
[[ -d $tap ]] && top=$(git -C "$tap" rev-parse --show-toplevel 2>/dev/null) && [[ $top == "$(cd "$tap" && pwd -P)" ]] ||
die "no tap checkout at $tap: clone devvmhq/homebrew-tap there, or set DEVVM_TAP_DIR"
[[ $(git -C "$tap" symbolic-ref -q --short HEAD) == main ]] || die "the tap at $tap isn't on main"
[[ -z $(git -C "$tap" status --porcelain) ]] || die "the tap at $tap isn't clean: commit or remove what git status lists"
tap_origin=$(remote_ref "$tap" refs/heads/main) || die "can't read the tap's origin (git -C $tap ls-remote origin)"
tap_head=$(git -C "$tap" rev-parse HEAD)
if [[ -n $tap_origin && $tap_origin != "$tap_head" ]]; then
git -C "$tap" merge-base --is-ancestor "$tap_origin" "$tap_head" 2>/dev/null ||
die "the tap's origin has commits its main lacks: git -C $tap pull"
fi
fi
# The build, from the tag. minisign asks for the password.
@@ -114,37 +129,52 @@ done_main=false done_tag=false done_release=false done_tap=false
[[ $origin_main != "$commit" ]] || done_main=true
[[ $origin_tag != "$tagobj" ]] || done_tag=true
[[ $release != published ]] || done_release=true
if cmp -s "$tap/Formula/devvm.rb" dist/devvm.rb && [[ $tap_origin == "$tap_head" ]]; then done_tap=true; fi
if $pre || { cmp -s "$tap/Formula/devvm.rb" dist/devvm.rb && [[ $tap_origin == "$tap_head" ]]; }; then done_tap=true; fi
state() { if $1; then echo "done"; else echo "$2"; fi; }
echo
echo "==> devvm $v, to publish"
echo "Version: $v"
kind=release
$pre && kind=prerelease
if $pre; then echo "Version: $v, a prerelease"; else echo "Version: $v"; fi
echo "Tag: $tag, signed, at commit $commit"
echo
echo "Files, from dist/, for the GitHub release $repo $tag:"
echo "Files, from dist/, for the GitHub $kind $repo $tag:"
for f in "${files[@]}"; do printf ' %-34s %10s bytes %s\n' "$f" "$(wc -c < "dist/$f" | tr -d ' ')" "$(sha256 "dist/$f")"; done
echo
echo "Release notes, CHANGELOG.md's ## $v:"
sed 's/^/ /' "$notes"
echo
echo "Tap, $tap, Formula/devvm.rb:"
old=$tap/Formula/devvm.rb
[[ -f $old ]] || old=/dev/null
git -C "$tap" diff --no-index -- "$old" "$root/dist/devvm.rb" || true
cmp -s "$old" dist/devvm.rb && echo " (already this release's)"
if $pre; then
echo "Tap: skipped, as this is a prerelease: Homebrew stays on the last release."
else
echo "Tap, $tap, Formula/devvm.rb:"
old=$tap/Formula/devvm.rb
[[ -f $old ]] || old=/dev/null
git -C "$tap" diff --no-index -- "$old" "$root/dist/devvm.rb" || true
cmp -s "$old" dist/devvm.rb && echo " (already this release's)"
fi
echo
echo "Steps:"
echo " 1. git push origin main: $(state $done_main "to do")"
echo " 2. git push origin $tag: $(state $done_tag "to do")"
todo="to do"
[[ $release != draft ]] || todo="to do, the draft's files replaced"
echo " 3. the GitHub release $tag: $(state $done_release "$todo")"
echo " 4. the tap's commit, devvm $v, and git push: $(state $done_tap "to do")"
$pre && todo="$todo, marked as a prerelease"
echo " 3. the GitHub $kind $tag: $(state $done_release "$todo")"
if $pre; then
echo " 4. the tap: skipped (a prerelease)"
else
echo " 4. the tap's commit, devvm $v, and git push: $(state $done_tap "to do")"
fi
echo
check() {
echo "Check it with Homebrew, brew update && brew upgrade devvm (or brew trust --formula devvmhq/tap/devvm, then brew install devvmhq/tap/devvm), or the install script:"
if $pre; then
echo "Check it with the install script, or devvm upgrade --to $v:"
else
echo "Check it with Homebrew, brew update && brew upgrade devvm (or brew trust --formula devvmhq/tap/devvm, then brew install devvmhq/tap/devvm), or the install script:"
fi
echo " curl -fsSL https://github.com/devvmhq/devvm/releases/download/$tag/install.sh | bash"
}
if $done_main && $done_tag && $done_release && $done_tap; then
@@ -176,9 +206,10 @@ step_release() {
if [[ $release == draft ]]; then
gh release upload "$tag" --repo "$repo" --clobber "${paths[@]}" || return 1
else
gh release create "$tag" --repo "$repo" --title "devvm $v" --notes-file "$notes" --verify-tag --draft "${paths[@]}" || return 1
gh release create "$tag" --repo "$repo" --title "devvm $v" --notes-file "$notes" --verify-tag --draft \
${pre_flag[@]+"${pre_flag[@]}"} "${paths[@]}" || return 1
fi
gh release edit "$tag" --repo "$repo" --title "devvm $v" --notes-file "$notes" --draft=false
gh release edit "$tag" --repo "$repo" --title "devvm $v" --notes-file "$notes" --draft=false ${pre_flag[@]+"${pre_flag[@]}"}
}
step_tap() {
$done_tap && { echo "the tap is already at devvm $v"; return 0; }
@@ -190,6 +221,10 @@ step_tap() {
}
names=(main tag release tap)
labels=("main on origin" "the tag $tag on origin" "the GitHub release $tag" "the tap's Formula/devvm.rb")
if $pre; then
names=(main tag release)
labels=("main on origin" "the tag $tag on origin" "the GitHub prerelease $tag")
fi
for i in "${!names[@]}"; do
echo "==> ${labels[$i]}"
if ! "step_${names[$i]}"; then
+55 -14
View File
@@ -1,19 +1,23 @@
#!/bin/bash
# Build a release's files in dist/ with GoReleaser (.goreleaser.yaml), from git (only what's committed):
# devvm-<version>-<os>-<arch>.tar.gz the binary and the files it reads, for darwin and linux, arm64 and amd64
# devvm-<version>.tar.gz the source, which the Homebrew formula builds from
# devvm-<version>.tar.gz the source, for whoever builds devvm themselves
# SHA256SUMS their checksums and install.sh's, which install.sh checks
# SHA256SUMS.minisig SHA256SUMS signed with the release key (minisign), which install.sh checks
# install.sh the install script, set to install this release and to trust the key
# devvm.rb the Homebrew formula for devvmhq/homebrew-tap
# Nothing is published. The version is VERSION's. The public key is packaging/minisign.pub (committed); the
# secret key is the maintainer's, at DEVVM_MINISIGN_KEY (default ~/.minisign/devvm.key), never in the repo.
# devvm.rb the Homebrew formula for devvmhq/homebrew-tap: each platform's archive
# Nothing is published. The version is VERSION's: x.y.z, or a prerelease's x.y.z-rc.N (any lowercase word,
# such as beta or alpha, then a number). The public key is packaging/minisign.pub (committed); the secret key
# is the maintainer's, at DEVVM_MINISIGN_KEY (default ~/.minisign/devvm.key), never in the repo.
# scripts/release.sh from the tag v<version>, which must exist and be signed (git tag -s)
# scripts/release.sh --head from HEAD, for testing (DEVVM_RELEASE_URL: where the source tarball will be;
# scripts/release.sh --head from HEAD, for testing (DEVVM_RELEASE_URL: where the archives will be;
# DEVVM_MINISIGN_KEY: a test key, else nothing is signed;
# DEVVM_MINISIGN_PUB: its public key, else packaging/minisign.pub)
# scripts/release.sh --check only the tag's checks and what the build needs, then prints the tag's commit
# (scripts/publish.sh runs it first); nothing is built
# scripts/release.sh --formula-from DIR
# only dist/devvm.rb, for VERSION's published release, from its SHA256SUMS
# and SHA256SUMS.minisig downloaded into DIR, checked against minisign.pub
# Needs goreleaser and minisign, pinned in mise.toml: mise exec -- scripts/release.sh.
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -21,14 +25,51 @@ cd "$root"
die() { echo "release: $*" >&2; exit 1; }
v=$(tr -d '[:space:]' < VERSION)
[[ $v =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || die "VERSION isn't x.y.z: '$v'"
# A release, x.y.z, or a prerelease of one, x.y.z-<word>.N (such as 0.2.0-rc.1 or 0.2.0-beta.2).
[[ $v =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$ ]] || die "VERSION isn't x.y.z or x.y.z-rc.N: '$v'"
ref=v$v
check=false
# formula TEMPLATE SUMS URL VERSION: the Homebrew formula, from its template, with each platform's
# archive's URL and its checksum from SHA256SUMS (on lines that aren't comments).
formula() {
awk -v sums="$2" -v u="$3" -v v="$4" '
BEGIN {
while ((getline line < sums) > 0) { split(line, f, " "); sha[f[2]] = f[1] }
split("darwin linux", oses, " "); split("arm64 amd64", arches, " ")
}
!/^#/ {
for (i in oses) for (j in arches) {
p = toupper(oses[i] "_" arches[j]); a = "devvm-" v "-" oses[i] "-" arches[j] ".tar.gz"
if (index($0, "@SHA256_" p "@")) {
if (sha[a] !~ /^[0-9a-f]+$/ || length(sha[a]) != 64) { print "SHA256SUMS has no " a > "/dev/stderr"; bad = 1 }
gsub("@SHA256_" p "@", sha[a])
}
gsub("@URL_" p "@", u "/" a)
}
if (/@[A-Z0-9_]+@/) { print "the formula has a placeholder left: " $0 > "/dev/stderr"; bad = 1 }
}
{ print } END { exit bad }' "$1"
}
case ${1:-} in
--head) ref=HEAD ;;
--check) check=true ;;
--formula-from)
# The formula for a published release, from its downloaded SHA256SUMS and SHA256SUMS.minisig in DIR,
# checked against packaging/minisign.pub; nothing is built.
dir=${2:-}
[[ -n $dir && -f $dir/SHA256SUMS && -f $dir/SHA256SUMS.minisig ]] || die "--formula-from DIR needs DIR/SHA256SUMS and DIR/SHA256SUMS.minisig"
command -v minisign >/dev/null || die "needs minisign (mise exec -- scripts/release.sh)"
minisign -Vm "$dir/SHA256SUMS" -x "$dir/SHA256SUMS.minisig" -p packaging/minisign.pub >/dev/null ||
die "$dir/SHA256SUMS doesn't verify with packaging/minisign.pub"
mkdir -p dist
formula packaging/homebrew/devvm.rb "$dir/SHA256SUMS" "https://github.com/devvmhq/devvm/releases/download/v$v" "$v" \
> dist/devvm.rb || die "couldn't write the formula"
echo "==> dist/devvm.rb for devvm $v, from $dir/SHA256SUMS"
exit 0 ;;
"") ;;
*) die "unknown argument '$1' (--head, --check)" ;;
*) die "unknown argument '$1' (--head, --check, --formula-from DIR)" ;;
esac
if [[ $ref == HEAD ]]; then obj=HEAD; else obj=$(git rev-parse -q --verify "refs/tags/$ref") || die "no tag $ref: tag the release first (git tag -s $ref)"; fi
# A release comes from a tag the maintainer signed, not just any tag with the right name. The tag
@@ -95,9 +136,6 @@ for bin in "$out"/devvm*_"${os}_$arch"*/devvm; do
[[ $got == "$v" ]] || die "$bin --version says '$got', not $v"
done
tarball=devvm-$v.tar.gz
sha=$(awk -v f="$tarball" '$2 == f { print $1 }' "$out/SHA256SUMS")
[[ $sha =~ ^[0-9a-f]{64}$ ]] || die "SHA256SUMS has no $tarball"
$sign || pubkey="" # an unsigned test build: its install.sh doesn't expect a signature
git show "$commit:install.sh" |
@@ -107,9 +145,8 @@ git show "$commit:install.sh" |
{ print } END { exit !(n == 1 && m == 1) }' \
> "$out/install.sh" || die "install.sh needs one release_version=\"\" and one minisign_key=\"\" line"
chmod 755 "$out/install.sh"
git show "$commit:packaging/homebrew/devvm.rb" |
awk -v u="$url/$tarball" -v s="$sha" '!/^#/ { gsub("@URL@", u); gsub("@SHA256@", s) } { print }' \
> "$out/devvm.rb"
git show "$commit:packaging/homebrew/devvm.rb" > "$tmp/devvm.rb" || die "no packaging/homebrew/devvm.rb in $ref"
formula "$tmp/devvm.rb" "$out/SHA256SUMS" "$url" "$v" > "$out/devvm.rb" || die "couldn't write the formula"
# install.sh's checksum goes in SHA256SUMS before it's signed, so you can check the script against the
# release key before you run it.
@@ -123,4 +160,8 @@ fi
echo "==> dist/ for devvm $v (from $ref):"
(cd "$out" && ls -l devvm-*.tar.gz SHA256SUMS* install.sh devvm.rb 2>/dev/null) || true
$sign || echo "(not signed: a test build without DEVVM_MINISIGN_KEY)"
echo "scripts/publish.sh publishes them: the archives, SHA256SUMS, SHA256SUMS.minisig and install.sh to the GitHub release v$v, devvm.rb to devvmhq/homebrew-tap's Formula/."
if [[ $v == *-* ]]; then
echo "scripts/publish.sh publishes them: the archives, SHA256SUMS, SHA256SUMS.minisig and install.sh to the GitHub prerelease v$v; devvm.rb stays out of the tap, which keeps the last release."
else
echo "scripts/publish.sh publishes them: the archives, SHA256SUMS, SHA256SUMS.minisig and install.sh to the GitHub release v$v, devvm.rb to devvmhq/homebrew-tap's Formula/."
fi
+21
View File
@@ -81,6 +81,27 @@ checksum = "sha256:4f573944c1d2059109d75a2f4d0cc9c03697288224a5e407717a9de98fc01
url = "https://github.com/openai/codex/releases/download/rust-v0.162.0/codex-package-x86_64-unknown-linux-musl.tar.gz"
url_api = "https://api.github.com/repos/openai/codex/releases/assets/622683980"
[[tools.dotnet]]
version = "10.0.401"
backend = "core:dotnet"
specifiers = ["latest"]
[tools.dotnet."platforms.linux-arm64"]
checksum = "sha512:8d8cd675b78d00ebc51379d4a733a46b88a79b7f816abdfd8d1957b15e9e6a84d6dc6de91e7fc0c18d81071a43aaf2954af7f6fa378e097a1238ec6520c32c9d"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.401/dotnet-sdk-10.0.401-linux-arm64.tar.gz"
[tools.dotnet."platforms.linux-arm64-musl"]
checksum = "sha512:12d55a49b8a94b9d132ad9e4846516347a9dae1789bc58fda9fa54293edb24d7d49293c5b865551dc8b8e1516832793a7c9988af4e43ae8c9c4f3b7b5a881ae9"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.401/dotnet-sdk-10.0.401-linux-musl-arm64.tar.gz"
[tools.dotnet."platforms.linux-x64"]
checksum = "sha512:bc87ac5d0cdaa601354fdf58d6680890e5ad1a11b63ff0042207ea392ad9f0a3a531e3d3e0c543f8dccf93a085d6df01459139eb581f9922c27d3f9ddba719cb"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.401/dotnet-sdk-10.0.401-linux-x64.tar.gz"
[tools.dotnet."platforms.linux-x64-musl"]
checksum = "sha512:3a994e48a600ec1cafc0bac75c84fd89701a3972ea4afb4cd3df84ab23ab5d0f863364d13d6baf0ae1e11d568706ca6689827da557dc63c728bbcd8983d91175"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.401/dotnet-sdk-10.0.401-linux-musl-x64.tar.gz"
[[tools.go]]
version = "1.27.2"
backend = "core:go"
+46 -3
View File
@@ -32,6 +32,20 @@ cp cloud-listing-none up/cloud-listing
stderr '^bump: upstream gave e2e_ubuntu_release an unexpected value: '''''
cmp repo/tests/e2e/sandbox_test.go e2e.before
# e2e-lima moves CI's Lima to the newest release and its Linux x86_64
# tarball's checksum, from a SHA256SUMS that matches the release notes'
# sha256; one that doesn't is refused, and nothing is edited.
exec repo/scripts/bump.sh e2e-lima
stdout '^ e2e-lima +[0-9.]+ +-> 9\.8\.7$'
exec grep -E '^ LIMA_(VERSION|SHA256):' repo/.github/workflows/e2e.yml
cmp stdout lima.want
exec bash repo.sh
cp repo/.github/workflows/e2e.yml e2e.yml.before
cp lima-sums-tampered up/lima-sums
! exec repo/scripts/bump.sh e2e-lima
stderr '^bump: Lima 9\.8\.7''s SHA256SUMS doesn''t match its release notes'' sha256$'
cmp repo/.github/workflows/e2e.yml e2e.yml.before
# Upstream values that aren't a version or a checksum are refused, and
# nothing is edited: a command for a checksum, one in a version, and a
# missing asset (an empty checksum).
@@ -68,6 +82,14 @@ stdout ' -> 9\.9\.9\[2J$'
! stdout '\x1b'
cmp repo/assets/oci/build.sh before
# An upstream latest older than the pin is never offered: the pin is
# reported as newer, and nothing is edited.
cp latest-older up/crane-latest
exec repo/scripts/bump.sh crane
stdout '^ crane +0\.22\.1 +newer than upstream''s latest, 0\.1\.0$'
! stdout ' -> '
cmp repo/assets/oci/build.sh before
# An unknown tool: refused.
! exec repo/scripts/bump.sh nope
stderr '^bump: unknown tool ''nope'''
@@ -76,8 +98,11 @@ stderr '^bump: unknown tool ''nope'''
# A copy of the files bump.sh edits, and upstream's good answers.
set -eu
rm -rf repo up
mkdir -p repo/scripts repo/assets/oci repo/assets/layers repo/internal/tools repo/tests/e2e up
mkdir -p repo/scripts repo/assets/oci repo/assets/layers repo/internal/tools repo/tests/e2e repo/.github/workflows up
cp "$DEVVM_REPO/scripts/bump.sh" repo/scripts/
cp "$DEVVM_REPO/.github/workflows/e2e.yml" repo/.github/workflows/
cp lima-latest up/lima-latest
cp lima-sums up/lima-sums
cp "$DEVVM_REPO/assets/oci/build.sh" repo/assets/oci/
cp "$DEVVM_REPO/assets/layers/base.sh" repo/assets/layers/
cp "$DEVVM_REPO/internal/tools/mise.go" repo/internal/tools/
@@ -89,9 +114,14 @@ cp mise-sums up/mise-sums
cp cloud-listing up/cloud-listing
-- bin/curl --
#!/bin/bash
# Answers crane's and mise's releases and Ubuntu's list of cloud image
# releases from $WORK/up/; anything else fails.
# Answers crane's, mise's and Lima's releases and Ubuntu's list of cloud
# image releases from $WORK/up/, to stdout or -o's file; anything else fails.
out=/dev/stdout
for a in "$@"; do [[ ${o:-} == next ]] && { out=$a; o=; }; [[ $a == -o ]] && o=next; done
exec >"$out"
for a in "$@"; do case $a in
*/lima-vm/lima/releases/latest) cat "$WORK/up/lima-latest"; exit ;;
*/lima-vm/lima/*/SHA256SUMS) cat "$WORK/up/lima-sums"; exit ;;
*/go-containerregistry/releases/latest) cat "$WORK/up/crane-latest"; exit ;;
*/go-containerregistry/*/checksums.txt) cat "$WORK/up/crane-sums"; exit ;;
*/jdx/mise/releases/latest) cat "$WORK/up/mise-latest"; exit ;;
@@ -99,6 +129,17 @@ for a in "$@"; do case $a in
https://cloud-images.ubuntu.com/releases/resolute/) cat "$WORK/up/cloud-listing"; exit ;;
esac; done
exit 22
-- lima-latest --
{"tag_name":"v9.8.7","body":"The sha256sum of the SHA256SUMS file itself is `58af05498b64199f1e9de8d1bc11ea71e397df7c0ece4f313dd7c4e44b9497b1` ."}
-- lima-sums --
7777777777777777777777777777777777777777777777777777777777777777 lima-9.8.7-Linux-aarch64.tar.gz
8888888888888888888888888888888888888888888888888888888888888888 lima-9.8.7-Linux-x86_64.tar.gz
-- lima-sums-tampered --
7777777777777777777777777777777777777777777777777777777777777777 lima-9.8.7-Linux-aarch64.tar.gz
9999999999999999999999999999999999999999999999999999999999999999 lima-9.8.7-Linux-x86_64.tar.gz
-- lima.want --
LIMA_VERSION: 9.8.7
LIMA_SHA256: 8888888888888888888888888888888888888888888888888888888888888888
-- cloud-listing --
<a href="release-19991231/">release-19991231/</a>
<a href="release-20000101/">release-20000101/</a> <a href="release-29990101/">release-29990101/</a>
@@ -109,6 +150,8 @@ exit 22
{"tag_name":"v9.9.9"}
-- latest-hostile --
{"tag_name":"v1$(id)"}
-- latest-older --
{"tag_name":"v0.1.0"}
-- latest-escape --
{"tag_name":"v9.9.9\u001b[2J"}
-- sums-good --
+1 -1
View File
@@ -111,7 +111,7 @@ stderr '^devvm: arg_missing args=TOOL\.\.\. command=devvm tools add$'
! exec devvm tools add python+claude
stderr '^devvm: tools_joined cmd=add given=python\+claude$'
! exec devvm tools add docker
stderr '^devvm: unknown_tool tool=docker tools=node python rust go claude codex opencode$'
stderr '^devvm: unknown_tool tool=docker tools=node python rust go dotnet claude codex opencode$'
exec devvm tools add node claude
stdout '^==> has_tools tools=node vm=devvm-web-[0-9a-f]{14}$'
stdout '^==> vm_tools_now tools=node claude vm=devvm-web-[0-9a-f]{14}$'
+33
View File
@@ -151,6 +151,23 @@ stderr '^install: --version needs a version$'
! exec bash main.sh --no-deps --version '1.2.3/../x'
stderr '^install: not a devvm version: ''1.2.3/../x''$'
# A prerelease, by --version or DEVVM_VERSION, checked as a release is;
# without either, the latest release, not the prerelease.
exec bash prerelease.sh --no-deps --version 0.2.0-rc.1
stdout '^==> signature checked$'
stdout '^==> installed devvm 0.2.0-rc.1: \S+/prefix/bin/devvm$'
stdout '^runs 0.2.0-rc.1$'
env DEVVM_VERSION=v0.2.0-rc.1
exec bash prerelease.sh --no-deps
stdout '^==> installed devvm 0.2.0-rc.1: '
env DEVVM_VERSION=
exec bash prerelease.sh --no-deps
stdout '^==> installed devvm 0.1.0: '
env SIG='good RWOTHERKEY'
! exec bash prerelease.sh --no-deps --version 0.2.0-rc.1
stderr '^install: devvm''s SHA256SUMS isn''t signed with the release key: not installed$'
env SIG=
# Homebrew's devvm, a keg in the Cellar next to the brew on PATH: the
# script stops before downloading anything, terminal or not, without
# running brew; --force installs a second copy.
@@ -301,6 +318,8 @@ for v in 0.1.0 1.20.3 2.0.0-rc.1; do valid_version "$v" && echo "valid $v"; done
for v in "" 1.2 "1.2.3/../x" "1.2.3 x" "1.2.3';id"; do valid_version "$v" || echo "invalid '$v'"; done
curl() { echo "https://github.com/devvmhq/devvm/releases/tag/v1.2.3%2F..%2Fx"; }
(latest_release https://github.com/devvmhq/devvm) 2>/dev/null || echo "odd latest refused"
curl() { echo "https://github.com/devvmhq/devvm/releases/tag/v0.4.0-rc.1"; }
(latest_release https://github.com/devvmhq/devvm) 2>/dev/null || echo "prerelease latest refused"
-- version.want --
0.2.0
0.1.5
@@ -314,6 +333,7 @@ invalid '1.2.3/../x'
invalid '1.2.3 x'
invalid '1.2.3';id'
odd latest refused
prerelease latest refused
-- fetch.sh --
. "$WORK/lib.sh"
curl() { echo "$*"; }
@@ -523,6 +543,19 @@ sudo usermod -aG kvm me
. "$WORK/lib.sh"
release 0.1.0
main "$@"
-- prerelease.sh --
# main.sh with a release, 0.1.0, the latest, and a prerelease,
# 0.2.0-rc.1, whose SHA256SUMS.minisig reads $SIG (default: good), for a
# script that trusts RWTESTKEY.
. "$WORK/lib.sh"
release 0.1.0
release 0.2.0-rc.1
echo "good RWTESTKEY" > "$WORK/repo/releases/download/v0.1.0/SHA256SUMS.minisig"
echo "${SIG:-good RWTESTKEY}" > "$WORK/repo/releases/download/v0.2.0-rc.1/SHA256SUMS.minisig"
minisign_key=RWTESTKEY
latest_release() { echo 0.1.0; }
main "$@"
echo "runs $("$prefix/bin/devvm")"
-- nobrew.sh --
# main.sh without a brew on PATH.
. "$WORK/lib.sh"
+67 -9
View File
@@ -72,7 +72,7 @@ stdout '^ devvm-1\.2\.3-linux-amd64\.tar\.gz +[0-9]+ bytes [0-9a-f]{64}$'
stdout '^ SHA256SUMS\.minisig +[0-9]+ bytes [0-9a-f]{64}$'
stdout '^ - \*\*New:\*\* a thing\.$'
! stdout 'Older'
stdout '^\+ url "https://github.com/devvmhq/devvm/releases/download/v1\.2\.3/devvm-1\.2\.3\.tar\.gz"$'
stdout '^\+ url "https://github.com/devvmhq/devvm/releases/download/v1\.2\.3/devvm-1\.2\.3-darwin-arm64\.tar\.gz"$'
stdout '^ 1\. git push origin main: to do$'
stdout '^ 4\. the tap''s commit, devvm 1\.2\.3, and git push: to do$'
stdout '^--dry-run: nothing published\.$'
@@ -142,6 +142,53 @@ stdout '^devvm 1\.2\.3 is already published: nothing to do\.$'
grep '^gh release download v1\.2\.3 ' calls
! grep 'push|create|edit' calls
# A prerelease, 1.3.0-rc.1: its GitHub release is marked as one, and it
# needs no tap checkout and leaves the tap alone.
exec bash prerelease.sh
rm gh/release
rm gh/notes
rm calls
env DEVVM_TAP_DIR=$WORK/nowhere
exec repo/scripts/publish.sh --dry-run
stdout '^Version: 1\.3\.0-rc\.1, a prerelease$'
stdout '^Tap: skipped, as this is a prerelease: Homebrew stays on the last release\.$'
stdout '^ 3\. the GitHub prerelease v1\.3\.0-rc\.1: to do, marked as a prerelease$'
stdout '^ 4\. the tap: skipped \(a prerelease\)$'
stdout '^ - \*\*New:\*\* another thing\.$'
! stdout 'Released today'
rm calls
ttyin -stdin yes.txt
exec repo/scripts/publish.sh
stdout '^==> devvm 1\.3\.0-rc\.1 is published$'
stdout '^Check it with the install script, or devvm upgrade --to 1\.3\.0-rc\.1:$'
cmp calls calls.pre
exists gh/prerelease
cmp gh/notes notes.pre
exec git -C tap.git log -1 --format=%s main
stdout '^devvm 1\.2\.3$'
# Run again: everything's done.
rm calls
exec repo/scripts/publish.sh
stdout '^devvm 1\.3\.0-rc\.1 is already published: nothing to do\.$'
! grep 'push|create|edit' calls
# A published prerelease that GitHub doesn't mark as one: refused.
rm gh/prerelease
! exec repo/scripts/publish.sh --dry-run
stderr '^publish: devvm v1\.3\.0-rc\.1 is a prerelease, but its GitHub release isn''t marked as one'
-- calls.pre --
gh auth status
gh release view v1.3.0-rc.1 --repo devvmhq/devvm --json isDraft,isPrerelease,assets --jq (.isDraft | tostring), (.isPrerelease | tostring), .assets[].name
push origin.git refs/heads/main
push origin.git refs/tags/v1.3.0-rc.1
gh release create v1.3.0-rc.1 --repo devvmhq/devvm --title devvm 1.3.0-rc.1 --notes-file notes.md --verify-tag --draft --prerelease devvm-1.3.0-rc.1-darwin-arm64.tar.gz devvm-1.3.0-rc.1-darwin-amd64.tar.gz devvm-1.3.0-rc.1-linux-arm64.tar.gz devvm-1.3.0-rc.1-linux-amd64.tar.gz devvm-1.3.0-rc.1.tar.gz SHA256SUMS SHA256SUMS.minisig install.sh
gh release edit v1.3.0-rc.1 --repo devvmhq/devvm --title devvm 1.3.0-rc.1 --notes-file notes.md --draft=false --prerelease
-- notes.pre --
A release candidate.
- **New:** another thing.
-- no.txt --
n
-- yes.txt --
@@ -188,10 +235,18 @@ git -C tap remote add origin "$PWD/tap.git"
git -C tap push -q origin main
rm -f calls
-- tag.sh --
# Tag v1.2.3 (again), signed with key $1.
# Tag $2, v1.2.3 without it, (again), signed with key $1.
set -eu
git -C repo tag -d v1.2.3 >/dev/null 2>&1 || true
git -C repo -c user.signingkey="$PWD/keys/$1" tag -s v1.2.3 -m v1.2.3
t=${2:-v1.2.3}
git -C repo tag -d "$t" >/dev/null 2>&1 || true
git -C repo -c user.signingkey="$PWD/keys/$1" tag -s "$t" -m "$t"
-- prerelease.sh --
# VERSION 1.3.0-rc.1 and its changelog entry, committed on main and tagged.
set -eu
echo 1.3.0-rc.1 > repo/VERSION
printf '# Changelog\n\n## 1.3.0-rc.1\n\nA release candidate.\n\n- **New:** another thing.\n\n## 1.2.3\n\nReleased today.\n' > repo/CHANGELOG.md
git -C repo commit -qam 'release 1.3.0-rc.1'
bash tag.sh good v1.3.0-rc.1
-- refs.sh --
# What origin and the tap hold: main's commit message, the tag, the tap's
# last commit, and whether it has the formula.
@@ -210,19 +265,19 @@ devvm 1.2.3
formula
-- calls.view --
gh auth status
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,assets --jq (.isDraft | tostring), .assets[].name
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,isPrerelease,assets --jq (.isDraft | tostring), (.isPrerelease | tostring), .assets[].name
-- calls.want --
gh auth status
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,assets --jq (.isDraft | tostring), .assets[].name
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,isPrerelease,assets --jq (.isDraft | tostring), (.isPrerelease | tostring), .assets[].name
push origin.git refs/heads/main
push origin.git refs/tags/v1.2.3
gh release create v1.2.3 --repo devvmhq/devvm --title devvm 1.2.3 --notes-file notes.md --verify-tag --draft devvm-1.2.3-darwin-arm64.tar.gz devvm-1.2.3-darwin-amd64.tar.gz devvm-1.2.3-linux-arm64.tar.gz devvm-1.2.3-linux-amd64.tar.gz devvm-1.2.3.tar.gz SHA256SUMS SHA256SUMS.minisig install.sh
gh auth status
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,assets --jq (.isDraft | tostring), .assets[].name
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,isPrerelease,assets --jq (.isDraft | tostring), (.isPrerelease | tostring), .assets[].name
gh release create v1.2.3 --repo devvmhq/devvm --title devvm 1.2.3 --notes-file notes.md --verify-tag --draft devvm-1.2.3-darwin-arm64.tar.gz devvm-1.2.3-darwin-amd64.tar.gz devvm-1.2.3-linux-arm64.tar.gz devvm-1.2.3-linux-amd64.tar.gz devvm-1.2.3.tar.gz SHA256SUMS SHA256SUMS.minisig install.sh
gh release edit v1.2.3 --repo devvmhq/devvm --title devvm 1.2.3 --notes-file notes.md --draft=false
gh auth status
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,assets --jq (.isDraft | tostring), .assets[].name
gh release view v1.2.3 --repo devvmhq/devvm --json isDraft,isPrerelease,assets --jq (.isDraft | tostring), (.isPrerelease | tostring), .assets[].name
gh release upload v1.2.3 --repo devvmhq/devvm --clobber devvm-1.2.3-darwin-arm64.tar.gz devvm-1.2.3-darwin-amd64.tar.gz devvm-1.2.3-linux-arm64.tar.gz devvm-1.2.3-linux-amd64.tar.gz devvm-1.2.3.tar.gz SHA256SUMS SHA256SUMS.minisig install.sh
gh release edit v1.2.3 --repo devvmhq/devvm --title devvm 1.2.3 --notes-file notes.md --draft=false
push tap.git refs/heads/main
@@ -243,7 +298,8 @@ Released today.
#!/bin/bash
# A gh that logs each call to $WORK/calls (paths as their base names) and
# keeps one release in $WORK/gh: release/ its files, draft while it's a
# draft, notes its notes. Switches: gh/no-auth fails gh auth status,
# draft, prerelease once it's marked as one, notes its notes. Switches:
# gh/no-auth fails gh auth status,
# gh/fail-create gh release create, gh/fail-edit gh release edit.
set -eu
s=$WORK/gh
@@ -262,6 +318,7 @@ files() {
--repo | --title | --pattern | --dir | --json | --jq) shift 2 ;;
--draft) touch "$s/draft"; shift ;;
--draft=false) rm -f "$s/draft"; shift ;;
--prerelease) touch "$s/prerelease"; shift ;;
--*) shift ;;
*) cp "$1" "$s/release/"; shift ;;
esac
@@ -272,6 +329,7 @@ case "$1 $2" in
"release view")
[[ -d $s/release ]] || { echo "release not found" >&2; exit 1; }
if [[ -e $s/draft ]]; then echo true; else echo false; fi
if [[ -e $s/prerelease ]]; then echo true; else echo false; fi
ls "$s/release" ;;
"release create")
[[ ! -e $s/fail-create ]] || { echo "HTTP 502: Bad Gateway" >&2; exit 1; }
+56 -18
View File
@@ -16,7 +16,7 @@ grep '^minisign_key=""$' repo/dist/install.sh
# With one: GoReleaser builds a snapshot with VERSION's version, SHA256SUMS
# is signed and verifies, install.sh is set to the release and the key, and
# the formula to the source tarball.
# the formula to each platform's archive.
rm log
exec minisign -G -W -p keys/test.pub -s keys/test.key
env DEVVM_MINISIGN_KEY=$WORK/keys/test.key DEVVM_MINISIGN_PUB=$WORK/keys/test.pub
@@ -33,11 +33,38 @@ cmp stdout sums.want
exec bash formula.sh
cmp stdout formula.want
# --formula-from: the same formula from a published release's signed
# SHA256SUMS, checked against packaging/minisign.pub; a changed one refused.
mkdir pub
cp repo/dist/SHA256SUMS repo/dist/SHA256SUMS.minisig pub/
cp repo/dist/devvm.rb devvm.rb.built
cp keys/test.pub repo/packaging/minisign.pub
exec repo/scripts/release.sh --formula-from $WORK/pub
cmp repo/dist/devvm.rb devvm.rb.built
exec bash -c 'echo x >> pub/SHA256SUMS'
! exec repo/scripts/release.sh --formula-from $WORK/pub
stderr 'SHA256SUMS doesn''t verify with packaging/minisign.pub$'
rm repo/packaging/minisign.pub
# Only what's committed goes in.
exec tar -tzf repo/dist/devvm-1.2.3.tar.gz
stdout '^devvm-1.2.3/VERSION$'
! stdout uncommitted
# A prerelease's VERSION, 1.3.0-rc.1: its archives, install.sh and the
# trusted comment all name it, and the tap is said to keep the last
# release.
exec bash -c 'echo 1.3.0-rc.1 > repo/VERSION && git -C repo commit -qam rc'
exec repo/scripts/release.sh --head
stdout 'GitHub prerelease v1\.3\.0-rc\.1; devvm\.rb stays out of the tap'
exists repo/dist/devvm-1.3.0-rc.1-linux-arm64.tar.gz
exists repo/dist/devvm-1.3.0-rc.1.tar.gz
grep '^release_version="1.3.0-rc.1"$' repo/dist/install.sh
grep 'releases/download/v1\.3\.0-rc\.1/devvm-1\.3\.0-rc\.1-darwin-arm64\.tar\.gz"$' repo/dist/devvm.rb
exec minisign -Vm repo/dist/SHA256SUMS -p keys/test.pub
stdout 'Trusted comment: devvm 1\.3\.0-rc\.1$'
exec bash -c 'echo 1.2.3 > repo/VERSION && git -C repo commit -qam back'
# A key that doesn't match the public key: refused.
exec minisign -G -W -p keys/other.pub -s keys/other.key
env DEVVM_MINISIGN_PUB=$WORK/keys/other.pub
@@ -56,10 +83,13 @@ exec bash -c 'printf ''#!/bin/sh\n'' > repo/install.sh && git -C repo commit -qa
! exec repo/scripts/release.sh --head
stderr 'install.sh needs one release_version="" and one minisign_key="" line$'
# A VERSION that isn't x.y.z: refused.
# A VERSION that isn't x.y.z or x.y.z-rc.N: refused.
exec bash -c 'echo 1.2 > repo/VERSION && git -C repo commit -qam bad-version'
! exec repo/scripts/release.sh --head
stderr '^release: VERSION isn''t x.y.z: ''1.2''$'
stderr '^release: VERSION isn''t x.y.z or x.y.z-rc.N: ''1.2''$'
exec bash -c 'echo 1.2.3-RC1 > repo/VERSION && git -C repo commit -qam bad-prerelease'
! exec repo/scripts/release.sh --head
stderr '^release: VERSION isn''t x.y.z or x.y.z-rc.N: ''1.2.3-RC1''$'
# A HEAD without install.sh: refused too.
exec bash -c 'echo 1.2.3 > repo/VERSION && git -C repo rm -q install.sh && git -C repo commit -qam no-install'
@@ -94,17 +124,23 @@ cd repo/dist
-- sums.want --
install.sh: OK
-- formula.sh --
# The formula's URL and checksum, against the source tarball's.
sha=$({ sha256sum 2>/dev/null || shasum -a 256; } < repo/dist/devvm-1.2.3.tar.gz | cut -c1-64)
grep -q "^ sha256 \"$sha\"$" repo/dist/devvm.rb && echo checksum
grep '^ url ' repo/dist/devvm.rb
# Nothing left to fill in, but in the comment that says what's filled in.
grep -v '^#' repo/dist/devvm.rb | grep '@' || true
grep -c '^# .*@URL@ and @SHA256@' repo/dist/devvm.rb
# Each platform's URL, and the checksum after it, against each archive's own
# and SHA256SUMS's line for it.
f=repo/dist/devvm.rb
grep -A1 '^ url ' "$f" | grep -v '^--$' | sed -n 'N;s/\n/ /;p' | while read -r _ u _ s; do
u=${u//\"/}; s=${s//\"/}; a=${u##*/}
sha=$({ sha256sum 2>/dev/null || shasum -a 256; } < "repo/dist/$a" | cut -c1-64)
[ "$s" = "$sha" ] && grep -q "^$sha $a$" repo/dist/SHA256SUMS && echo "$u checksum"
done
# Nothing left to fill in, and the comments as the template has them.
grep -v '^#' "$f" | grep '@' || true
diff <(grep '^#' repo/packaging/homebrew/devvm.rb) <(grep '^#' "$f") && echo comments
-- formula.want --
checksum
url "https://github.com/devvmhq/devvm/releases/download/v1.2.3/devvm-1.2.3.tar.gz"
1
https://github.com/devvmhq/devvm/releases/download/v1.2.3/devvm-1.2.3-darwin-arm64.tar.gz checksum
https://github.com/devvmhq/devvm/releases/download/v1.2.3/devvm-1.2.3-darwin-amd64.tar.gz checksum
https://github.com/devvmhq/devvm/releases/download/v1.2.3/devvm-1.2.3-linux-arm64.tar.gz checksum
https://github.com/devvmhq/devvm/releases/download/v1.2.3/devvm-1.2.3-linux-amd64.tar.gz checksum
comments
-- log.want --
release --clean --skip=publish --snapshot DEVVM_VERSION=1.2.3 GORELEASER_CURRENT_TAG=
-- bin/goreleaser --
@@ -122,11 +158,13 @@ for os in darwin linux; do
chmod 755 "dist/devvm_${os}_$a/devvm"
done
done
for a in arm64 amd64; do
mkdir -p "dist/x/devvm-$DEVVM_VERSION-linux-$a"
cp "dist/devvm_linux_$a/devvm" "dist/x/devvm-$DEVVM_VERSION-linux-$a/devvm"
tar -czf "dist/devvm-$DEVVM_VERSION-linux-$a.tar.gz" -C dist/x "devvm-$DEVVM_VERSION-linux-$a"
for os in darwin linux; do
for a in arm64 amd64; do
mkdir -p "dist/x/devvm-$DEVVM_VERSION-$os-$a"
cp "dist/devvm_${os}_$a/devvm" "dist/x/devvm-$DEVVM_VERSION-$os-$a/devvm"
tar -czf "dist/devvm-$DEVVM_VERSION-$os-$a.tar.gz" -C dist/x "devvm-$DEVVM_VERSION-$os-$a"
done
done
rm -rf dist/x
git archive --prefix="devvm-$DEVVM_VERSION/" HEAD | gzip -n > "dist/devvm-$DEVVM_VERSION.tar.gz"
(cd dist && { sha256sum "devvm-$DEVVM_VERSION.tar.gz" 2>/dev/null || shasum -a 256 "devvm-$DEVVM_VERSION.tar.gz"; } > SHA256SUMS)
(cd dist && { sha256sum devvm-*.tar.gz 2>/dev/null || shasum -a 256 devvm-*.tar.gz; } > SHA256SUMS)
+22
View File
@@ -91,6 +91,28 @@ ttyin -stdin $WORK/no.txt
! exec $DEVVM
stdout '^==> upgrade_available current=0.1.0 latest=0.2.0$'
# A prerelease is never announced: a record naming one is none, and a
# check that finds one at releases/latest keeps what it knew.
json_set $DATA/cache/release.json latest=0.3.0-rc.1
ttyin -stdin $WORK/no.txt
! exec $DEVVM
! stdout upgrade_available
json_set $DATA/cache/release.json latest=0.2.0 tried=2026-01-01T00:00:00Z
release_server 0.3.0-rc.1
ttyin -stdin $WORK/no.txt
! exec $DEVVM
stdout '^==> upgrade_available current=0.1.0 latest=0.2.0$'
grep '"latest":"0.2.0"' $DATA/cache/release.json
! grep '"tried":"2026-01-01' $DATA/cache/release.json
# On a prerelease, the release it comes before is announced once it's
# out.
env DEVVM_TEST_VERSION=0.3.0-rc.1
json_set $DATA/cache/release.json latest=0.3.0
ttyin -stdin $WORK/no.txt
! exec $DEVVM
stdout '^==> upgrade_available current=0.3.0-rc.1 latest=0.3.0$'
-- no.txt --
n
-- off.toml --
+32
View File
@@ -97,6 +97,29 @@ project cli
exec devvm --network open --no-git-protect --tools go --agents claude
! stdout 'checking_tools|building_tools'
# A .NET project's file calls for dotnet, named in the summary. Its build
# gets the lock's download for this VM's platform and its SHA-512 after
# its tool, version and file, which build.sh checks the SDK's archive
# against (mise's own installer for it checks nothing).
project shop
cp $WORK/Shop.csproj Shop.csproj
stub_reset
exec devvm --network open --no-git-protect
stdout '^new_vm_toolchain_for file=Shop\.csproj tool=dotnet$'
stdout '^==> building_tools tools=dotnet 10\.0\.401$'
vm_name SHOP shop
vm_state $SHOP_dir/vm.json
stdout '^tools.names=dotnet$'
stdout '^tools.made.files=dotnet-10\.0\.401-[0-9a-f]{12}\.erofs$'
stub_calls
stdout '^limactl shell --workdir / devvm-tools-build bash -s -- dotnet 10\.0\.401 dotnet-10\.0\.401-[0-9a-f]{12}\.erofs https://builds\.dotnet\.microsoft\.com/dotnet/Sdk/10\.0\.401/dotnet-sdk-10\.0\.401-linux-(arm64|x64)\.tar\.gz [0-9a-f]{128}$'
# global.json alone calls for it too.
project sdk
cp $WORK/global.json global.json
exec devvm --network open --no-git-protect
stdout '^new_vm_toolchain_for file=global\.json tool=dotnet$'
! stdout 'building_tools'
# The shared tools aren't images: build and rebuild refuse them.
! exec devvm rebuild node
stderr '^devvm: tool_not_layer tool=node$'
@@ -171,3 +194,12 @@ late: 1, mount ./share
never: 60, 60 mounts
-- package.json --
{}
-- Shop.csproj --
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>
-- global.json --
{ "sdk": { "version": "10.0.401" } }
+63
View File
@@ -0,0 +1,63 @@
# The host's mise and a network that inspects TLS: a certificate mise
# doesn't trust says so and names the CA folder, both before the first
# lock and when it's resolved again; mise gets the folder's CAs as extra
# ones (MISE_EXTRA_CA_CERTS), and on Linux a bundle of the system's roots
# and them (SSL_CERT_FILE).
env CAS=$XDG_CONFIG_HOME/devvm/ca
# No lock yet: the certificate, not being offline.
env MISE_STUB_FAIL=untrusted
project py
! exec devvm --network open --no-git-protect --tools python
stdout '^==> resolving_tools$'
stderr 'invalid peer certificate: UnknownIssuer'
stderr '^devvm: tools_untrusted dir=\S*/config/devvm/ca$'
! stderr tools_need_resolve
! exists $DATA/mise.lock
! exists $STUB_DIR/mise-ca.pem
# With the company's CA in the folder, around text of its own, mise's
# extra CAs are the certificate alone; on Linux its roots, the system's
# bundle and that CA, end with it, and on macOS it gets none.
mkdir $CAS
cp $WORK/company.pem $CAS/company.pem
! exec devvm --network open --no-git-protect --tools python
stderr '^devvm: tools_untrusted dir=\S*/config/devvm/ca$'
cmp $STUB_DIR/mise-ca.pem $WORK/ca-only.pem
[linux] exec tail -n 10 $STUB_DIR/mise-roots.pem
[linux] cmp stdout $WORK/ca-only.pem
[!linux] ! exists $STUB_DIR/mise-roots.pem
# Trusted, it resolves; resolving again fails the same way, the lock left.
env MISE_STUB_FAIL=
exec devvm --network open --no-git-protect --tools python
cmp $DATA/mise.lock $MISE_STUB_LOCK
env MISE_STUB_FAIL=untrusted
! exec devvm _refresh-tools
stderr '^devvm: tools_untrusted dir=\S*/config/devvm/ca$'
cmp $DATA/mise.lock $MISE_STUB_LOCK
-- company.pem --
# Company root, exported from the host's store
-----BEGIN CERTIFICATE-----
MIIBVjCB/aADAgECAhQ2DjUE5GCuu3ghlAaTzuuBTKpHPzAKBggqhkjOPQQDAjAY
MRYwFAYDVQQDDA1kZXZ2bSB0ZXN0IENBMCAXDTI2MTAzMTAwNDM1MloYDzIxMjYx
MDA3MDA0MzUyWjAYMRYwFAYDVQQDDA1kZXZ2bSB0ZXN0IENBMFkwEwYHKoZIzj0C
AQYIKoZIzj0DAQcDQgAEXBvNefEBySKRQIYneFCwVPU9XeTIb9BQmqWNOzHUUZ14
yJRSOti9OaVDmBkNGfc8s9Y6EH+kO0OUh7d/ZobZaKMjMCEwDwYDVR0TAQH/BAUw
AwEB/zAOBgNVHQ8BAf8EBAMCAgQwCgYIKoZIzj0EAwIDSAAwRQIgEzyH5x1Z+iba
nf2OXZ+UmygJuhGk1Wbhqk3OSSCAPKYCIQCSBQAoZ0blPVefpXNe9FNJEicksKlE
Ak+ibQllnrw4LA==
-----END CERTIFICATE-----
private notes after it
-- ca-only.pem --
-----BEGIN CERTIFICATE-----
MIIBVjCB/aADAgECAhQ2DjUE5GCuu3ghlAaTzuuBTKpHPzAKBggqhkjOPQQDAjAY
MRYwFAYDVQQDDA1kZXZ2bSB0ZXN0IENBMCAXDTI2MTAzMTAwNDM1MloYDzIxMjYx
MDA3MDA0MzUyWjAYMRYwFAYDVQQDDA1kZXZ2bSB0ZXN0IENBMFkwEwYHKoZIzj0C
AQYIKoZIzj0DAQcDQgAEXBvNefEBySKRQIYneFCwVPU9XeTIb9BQmqWNOzHUUZ14
yJRSOti9OaVDmBkNGfc8s9Y6EH+kO0OUh7d/ZobZaKMjMCEwDwYDVR0TAQH/BAUw
AwEB/zAOBgNVHQ8BAf8EBAMCAgQwCgYIKoZIzj0EAwIDSAAwRQIgEzyH5x1Z+iba
nf2OXZ+UmygJuhGk1Wbhqk3OSSCAPKYCIQCSBQAoZ0blPVefpXNe9FNJEicksKlE
Ak+ibQllnrw4LA==
-----END CERTIFICATE-----
+1 -1
View File
@@ -158,7 +158,7 @@ stderr '^devvm: part_other_flag flag=--tools given=claude other=--agents$'
! exec devvm --tools node,docker
stderr '^devvm: part_other_flag flag=--tools given=docker other=--layers$'
! exec devvm --tools java
stderr '^devvm: unknown_part flag=--tools given=java names=node python rust go$'
stderr '^devvm: unknown_part flag=--tools given=java names=node python rust go dotnet$'
! exec devvm --agents cladue
stderr '^devvm: unknown_part_like flag=--agents given=cladue like=claude$'
! exec devvm --layers node
+45
View File
@@ -108,6 +108,51 @@ stdout '^==> upgrade_done link=\S+/pfx/bin/devvm version=0.1.0\n'
exec pfx/bin/devvm --version
stdout '^0.1.0$'
# Prereleases: the newest release is never one, so from 0.2.0 there's
# nothing newer, and only --to installs 0.3.0-rc.1.
env DEVVM_TEST_VERSION=0.2.0
cp_exe $DEVVM_BIN/devvm pfx/lib/devvm/0.1.0/devvm
release_server 0.2.0 0.3.0-rc.1
exec pfx/bin/devvm upgrade --check
stdout '^==> upgrade_already_latest version=0.2.0\n\z'
env DEVVM_PIPED_ANSWERS=1
stdin yes.txt
exec pfx/bin/devvm upgrade --to v0.3.0-rc.1
env DEVVM_PIPED_ANSWERS=
stdout '^==> upgrade_done link=\S+/pfx/bin/devvm version=0.3.0-rc.1\n'
exec pfx/bin/devvm --version
stdout '^0.3.0-rc.1$'
# On 0.3.0-rc.1 before 0.3.0 is out, the newest release is older: said,
# and nothing installed, without a failure.
env DEVVM_TEST_VERSION=0.3.0-rc.1
cp_exe $DEVVM_BIN/devvm pfx/lib/devvm/0.3.0-rc.1/devvm
exec pfx/bin/devvm upgrade --force
stdout '^==> upgrade_prerelease_ahead current=0.3.0-rc.1 latest=0.2.0\n\z'
exec pfx/bin/devvm upgrade --check
stdout '^==> upgrade_prerelease_ahead current=0.3.0-rc.1 latest=0.2.0\n\z'
exec pfx/bin/devvm upgrade --json
stdout '"newer": false'
# Once 0.3.0 is out it's offered, never the newer prerelease 0.3.0-rc.2,
# and it replaces the prerelease.
release_server 0.3.0 0.3.0-rc.2
exec pfx/bin/devvm upgrade --check
stdout '^==> upgrade_available current=0.3.0-rc.1 latest=0.3.0\n\z'
exec pfx/bin/devvm upgrade --force
stdout '^==> upgrade_done link=\S+/pfx/bin/devvm version=0.3.0\n'
exec pfx/bin/devvm --version
stdout '^0.3.0$'
# A prerelease where only a release belongs, at releases/latest, is
# refused.
env DEVVM_TEST_VERSION=0.3.0
cp_exe $DEVVM_BIN/devvm pfx/lib/devvm/0.3.0/devvm
release_server 0.4.0-rc.1
! exec pfx/bin/devvm upgrade --force
stderr '^devvm: upgrade_no_latest url=\S+$'
! exists pfx/lib/devvm/0.4.0-rc.1
# Homebrew's: brew upgrade devvm, asked first, and never --to.
env DEVVM_TEST_VERSION=0.1.0
release_server 0.2.0
+38 -9
View File
@@ -1,7 +1,7 @@
# devvm e2e: shared-tools/mise.toml sha256:762f3315cb35adef2ae10e1f81289c348c37afcc768ff9119689af5058de84a4
# devvm e2e: shared-tools/mise.toml sha256:4ab9d148c8cf4837708baa7dcbc7458163589863c1c142c8d0fedfdfac2af4ef
# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html
lockfile_version = 3
lockfile_version = 4
[[tools.bun]]
version = "1.4.4"
@@ -39,21 +39,25 @@ specifiers = ["latest"]
[tools.claude."platforms.linux-arm64"]
checksum = "sha256:0f4fb66a2af3bf02d114099727e4a7745f117b1e63d2f77c8aff165590197421"
checksum_source = "mise-versions"
url = "https://github.com/anthropics/claude-code/releases/download/v2.1.318/claude-linux-arm64.tar.gz"
url_api = "https://api.github.com/repos/anthropics/claude-code/releases/assets/707216465"
[tools.claude."platforms.linux-arm64-musl"]
checksum = "sha256:198e232519752b4f64a39252507cd693b16eb2107a36ecc4a2b78971d1ad36ef"
checksum_source = "mise-versions"
url = "https://github.com/anthropics/claude-code/releases/download/v2.1.318/claude-linux-arm64-musl.tar.gz"
url_api = "https://api.github.com/repos/anthropics/claude-code/releases/assets/707216467"
[tools.claude."platforms.linux-x64"]
checksum = "sha256:e6d426ca0c123f61fad58a361da0329f2a93cd206bc87040ed8d9576dd9eb583"
checksum_source = "mise-versions"
url = "https://github.com/anthropics/claude-code/releases/download/v2.1.318/claude-linux-x64.tar.gz"
url_api = "https://api.github.com/repos/anthropics/claude-code/releases/assets/707216832"
[tools.claude."platforms.linux-x64-musl"]
checksum = "sha256:6f6d85b6faf3f5ed2655e9aefd52289ca30647ed4503647c2bfd342e1a5431f9"
checksum_source = "mise-versions"
url = "https://github.com/anthropics/claude-code/releases/download/v2.1.318/claude-linux-x64-musl.tar.gz"
url_api = "https://api.github.com/repos/anthropics/claude-code/releases/assets/707216466"
@@ -82,6 +86,27 @@ checksum = "sha256:1d44b28bc4ac9937d7d3532264baa68a507ce364956a0d4ebb856f331cdee
url = "https://github.com/openai/codex/releases/download/rust-v0.166.0/codex-package-x86_64-unknown-linux-musl.tar.gz"
url_api = "https://api.github.com/repos/openai/codex/releases/assets/689712510"
[[tools.dotnet]]
version = "10.0.403"
backend = "core:dotnet"
specifiers = ["latest"]
[tools.dotnet."platforms.linux-arm64"]
checksum = "sha512:0966aa2b70f4677b8319be9df447a78a0dcd6164836425b55a68fd714f4023feb87b4cac21b9a996b79472ad54487cd0adcd2a9dfd570e2b2a1d26423a2baa9b"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.403/dotnet-sdk-10.0.403-linux-arm64.tar.gz"
[tools.dotnet."platforms.linux-arm64-musl"]
checksum = "sha512:a5a881429e879f0ff01e84a768dbc022e7fed0f4c2fe4936c0bec134fa184d16b42f98e1e43bc1c0fea5e9ce442fe57efc87bdc04023e337f9b0013c849bc2b1"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.403/dotnet-sdk-10.0.403-linux-musl-arm64.tar.gz"
[tools.dotnet."platforms.linux-x64"]
checksum = "sha512:b7b3d8461cf98b07d2552ce9199702fa3ad010ac2671a5f8cd5136f7534e50f6855ba7bbb02b11494563f1d04156276a31cda1103b900e5eecd0d9473dc7b9c5"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.403/dotnet-sdk-10.0.403-linux-x64.tar.gz"
[tools.dotnet."platforms.linux-x64-musl"]
checksum = "sha512:7c85806aeb15b5c02e282234532ac599f69409e45ba4ef09c13e848441d3a092c4e030efaaecbd271896c4137429c90daf3f44ca9805fa27468cc2323c670ac8"
url = "https://builds.dotnet.microsoft.com/dotnet/Sdk/10.0.403/dotnet-sdk-10.0.403-linux-musl-x64.tar.gz"
[[tools.go]]
version = "1.27.3"
backend = "core:go"
@@ -126,28 +151,32 @@ url = "https://unofficial-builds.nodejs.org/download/release/v24.22.2/node-v24.2
[[tools.opencode]]
version = "2.2.5"
backend = "aqua:anomalyco/opencode"
backend = "github:anomalyco/opencode"
specifiers = ["2"]
[tools.opencode."platforms.linux-arm64"]
checksum = "sha256:5a528f42caf576c6cdece6a191eb273d3db54effa5518e0402684d8f8026aeb6"
url = "https://github.com/anomalyco/opencode/releases/download/v2.2.5/opencode-linux-arm64.tar.gz"
url_api = "https://api.github.com/repos/anomalyco/opencode/releases/assets/693720697"
provenance = "github-attestations"
[tools.opencode."platforms.linux-arm64-musl"]
checksum = "sha256:5a528f42caf576c6cdece6a191eb273d3db54effa5518e0402684d8f8026aeb6"
url = "https://github.com/anomalyco/opencode/releases/download/v2.2.5/opencode-linux-arm64.tar.gz"
url_api = "https://api.github.com/repos/anomalyco/opencode/releases/assets/693720697"
checksum = "sha256:bbf927e3f7a92040f25fd78436c251f41deb25cefac1c906e79c01aa572bf73b"
url = "https://github.com/anomalyco/opencode/releases/download/v2.2.5/opencode-linux-arm64-musl.tar.gz"
url_api = "https://api.github.com/repos/anomalyco/opencode/releases/assets/693720529"
provenance = "github-attestations"
[tools.opencode."platforms.linux-x64"]
checksum = "sha256:09f44302c10fd036912f59c81fd1aef5df45dd06f649197f9dfc9bbe2a79614e"
url = "https://github.com/anomalyco/opencode/releases/download/v2.2.5/opencode-linux-x64.tar.gz"
url_api = "https://api.github.com/repos/anomalyco/opencode/releases/assets/693720872"
provenance = "github-attestations"
[tools.opencode."platforms.linux-x64-musl"]
checksum = "sha256:09f44302c10fd036912f59c81fd1aef5df45dd06f649197f9dfc9bbe2a79614e"
url = "https://github.com/anomalyco/opencode/releases/download/v2.2.5/opencode-linux-x64.tar.gz"
url_api = "https://api.github.com/repos/anomalyco/opencode/releases/assets/693720872"
checksum = "sha256:889389e99ffa39fa41d512b2c9c15316522d97398fb912503ef667f80e22a827"
url = "https://github.com/anomalyco/opencode/releases/download/v2.2.5/opencode-linux-x64-musl.tar.gz"
url_api = "https://api.github.com/repos/anomalyco/opencode/releases/assets/693720744"
provenance = "github-attestations"
[[tools.pnpm]]
version = "12.18.0"
+5 -2
View File
@@ -20,9 +20,9 @@ import (
// (scripts/bump.sh e2e-from moves the digests). One check keeps a tag,
// so devvm's registry lookup is checked too: the company proxy's
// alpine:3.21, converted each run anyway.
const fromNodeDigest = "sha256:e7add2a490bb17d97b485b8641bd88455fff7839ade0f5eba493c3508124d413"
const fromNodeDigest = "sha256:8fa96264f302f58bbb13aa7339c541547b56975766ce956c875da149452a3e40"
const fromAlpineDigest = "sha256:be2656061b536c1883c4034790e21d0a09c5aaaf51968b89368a3c0371ea2c9a"
const fromAlpineDigest = "sha256:3f4d6b32e26703c6082839234f43769d5046b3ac7c910033911d1e71d8cd630a"
const fromUbuntuDigest = "sha256:6a06111c3b0a8600feadb270aec771dc239bf407b25625f93f44ab00e11f4d3c"
@@ -258,6 +258,7 @@ func fromDebianRuns(s *S, vm string) {
func fromAlpineVM(s *S, nd []string) {
al, _ := s.NewProject("fromalpine")
_ = os.WriteFile(filepath.Join(al, "package.json"), []byte("{}\n"), 0o644) //nolint:gosec // a project's file, as a user's
_ = os.WriteFile(filepath.Join(al, "global.json"), []byte("{}\n"), 0o644) //nolint:gosec // a project's file, as a user's
vm, launched, _ := launchWith(s, al, nd, "--from", fromAlpine, "--network", "open", "--layers", "docker,nix,desktop")
s.Check("an Alpine VM runs node from musl tool images", func() error {
if vm == "" || s.Paths.State(vm)["tools.made.libc"] != "musl" || s.Paths.Record(fromRecord(s.Paths, fromAlpine), "libc") != "musl" {
@@ -286,6 +287,8 @@ func fromAlpineVM(s *S, nd []string) {
})
inVMCheck(s, "and node, pnpm work there", vm,
"grep -q '^ID=alpine' /etc/os-release && [[ $(node -v) == v"+s.Paths.ToolVersion("node")+` ]] && node -e 'require("os")' && pnpm -v`)
inVMCheck(s, "and dotnet, its global.json's: the musl SDK, with ICU, makes and runs a console project", vm,
"[[ $(dotnet --version) == "+s.Paths.ToolVersion("dotnet")+" ]] && cd /tmp && dotnet new console -o hello >/dev/null && [[ $(dotnet run --project hello) == 'Hello, World!' ]]")
inVMCheck(s, "the docker layer's Docker runs in it (OpenRC)", vm, `sudo docker run --rm hello-world | grep -q Hello`, Needs(backend.FeatureDockerLayer))
inVMCheck(s, "the desktop layer's programs are in it (Alpine's packages)", vm,
`command -v Xvnc && command -v startxfce4 && command -v vncconfig && [[ -x /usr/local/bin/devvm-desktop ]]`)
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff. Show more