Skip to content

[backport-0.21] Add SSHFS-backed volumes - #13958

Merged
sipsma merged 3 commits into
dagger:backport-0.21from
sipsma:backport-13462-0.21
Aug 24, 2026
Merged

sipsma merged 3 commits into
dagger:backport-0.21from
sipsma:backport-13462-0.21

Conversation

@sipsma

@sipsma sipsma commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Backports #13462 to the v0.21 maintenance line for v0.21.9.

This adds an opaque Volume object backed by SSHFS, allowing workflows to mount remote SSH/SFTP filesystems into containers without first copying their contents into Dagger's content store. The backport preserves the source security and cache behavior: host-key verification is required unless explicitly disabled, credentials remain secret dependencies, mounts are cleaned up after exec, and a cached exec does not reread changed remote contents.

Modules may accept, pass, and mount Volume values, but may not construct SSHFS volumes. Query.sshfsVolume and Address.volume remain main-client-only and are removed from module SDK introspection; Volume and Container.withMountedVolume remain available to modules.

Source provenance

  • Source PR: Add SSHFS-backed volumes #13462
  • Source PR head: 5500d33f5a40fe4e016c387ce6f3eda8513b260e
  • Source PR commits: 21d0fa4ae53779b94ae199fbabe24e0427b5c23a, cad82a10729e13b2bd967f14ae7ebc8584224378, 32b4865880a18494dc920e6b63bc1b59e71d0e82, 4385c543c47d1ac59af2650f2d0cf47aa405de22, and 5500d33f5a40fe4e016c387ce6f3eda8513b260e
  • Main squash commit: 903e583 (its tree is identical to the source PR head)
  • Required source-parent field-scrubbing commit: 49b99b6
  • Required source-parent object-view pieces: c54a8fd
  • Current-linter compatibility: e17f17d

Applied as three DCO-signed commits on exact base 00c993cbe47ba494262871052b9ab4a547989b1d:

  1. cfa395965b7c2105e8368d88aa74b4d27961f65a — field-level schema scrubbing, cherry-picked with -x -s from 49b99b630fb81b4bf8bb2cd6bee1f9633f8b9e53, with its test adapted from mainline's Workspace API to v0.21's Directory API.
  2. 9d37de1393bfe0f35dd45468fa37bf8a7f1b258e — source squash, cherry-picked with -x -s from 903e58303ac07dff4657bcb5a697d510732e2243, with release-line conflict resolution and the narrowly required object-view pieces from c54a8fd0003e269ad6ca4eef7604dc49e578505b.
  3. df58b82f1f507176f05d8008f193acdb5fd61611 — v0.21.9 gates, release-native test helpers, current generated outputs, release note, and the applicable lint compatibility from e17f17d4a020efd59c31bc5faf301e6f1186361d.

Final range: 00c993cbe47ba494262871052b9ab4a547989b1d..df58b82f1f507176f05d8008f193acdb5fd61611 (3 commits, 71 files, 5,342 insertions, 213 deletions).

v0.21 adaptation

  • Retarget the source's future v1.0.0-0 API gates to v0.21.9-0. A focused schema test proves Volume is absent, including all return/argument references, in v0.21.8 and present with all intended fields in v0.21.9.
  • Map the source CLI changes from main's internal/cmd/dagger / daggercmd layout to v0.21's cmd/dagger / main layout.
  • Omit post-v0.21 Workspace documentation/sidebar and Query.currentWorkspace introspection expectations.
  • Omit resolveModuleRef from Address.volume; module-address resolution was added after v0.21 and is not required for SSHFS address parsing on this line.
  • Carry only the class/view, schema filtering, legacy-ID, and environment-binding view propagation needed to keep the gated Volume type and generated fields out of older schema views.
  • Adapt the two post-v0.21 integration fixture helpers to the equivalent v0.21 fscopy, goGitBase, and withModuleFixture helpers.
  • Regenerate Go, TypeScript, Python, Rust, Elixir, PHP, GraphQL schema, and API/reference outputs against the v0.21.9 view.

No product/API redesign or unrelated SSHFS change is included.

Validation

Passed at final head:

  • go test ./cmd/codegen/introspection ./core ./core/schema ./dagql -count=1
  • (cd toolchains/engine-dev && go test ./build -count=1)
  • go test ./core/integration -run '^$' -count=1
  • dagger call engine-dev test --pkg ./core/integration --run TestVolume — 6 passed, trace 067e4eb974fdd5e7a31733b80fab29b3
  • dagger call engine-dev test --pkg ./cmd/dagger --run 'TestVolume(CustomFlagValue|SliceCustomFlagValue)' — 2 passed, trace a004d770afbea8e7d0a14dbc90aee3bc
  • focused generation in a clean full clone: go-sdk:generate, engine-dev:generate, TypeScript client/format, Python client, Rust API client, Elixir client, PHP API, and docs references — all 9 passed
  • the same 9 generators with --no-apply — all passed and reported no changes to apply
  • pinned Go lint for core — trace 6a627c867607bd1aa9598dffa9d36464
  • pinned Go lint for cmd/dagger — trace 6baccc15622d3779effda52309999b3a
  • pinned Go lint for dagql — trace e95775682116f4aba485067907234ec8
  • pinned Go lint for toolchains/engine-dev — trace 92f717eadc0714e8023a69ff96784007
  • markdown lint — trace fc9e7f3c522c1a4901f0e7668e0364f5
  • gofmt, DCO/signoff, clean worktree, exact base ancestry, and git diff --check outside generated PHP reference HTML

First failure and environment/tooling controls:

  • The first integration attempt failed before test execution because the source referenced the two post-v0.21 fixture helpers; trace 5f9f256c54e0f0648a9dfeaf681be76a. The equivalent release helpers above compile and the exact rerun passes all 6 tests.
  • The broad current-CLI workspace dagger generate -y / dagger check -l entrypoints cannot load all v0.21 toolchains: current core Changeset identity and Workspace/LLM APIs differ from the pinned release modules. Focused generation and direct toolchain checks above bypass that pre-existing workspace incompatibility.
  • A broad root lint reaches unchanged documentation snippet modules that do not contain generated internal/dagger packages (trace 373d15944dce04474c11bf68c7f1a9ab). Every changed Go area passes the same pinned linter when scoped as above.
  • The PHP reference generator emits trailing whitespace in generated HTML, including on the source PR. Those generated files are the only git diff --check exceptions and are idempotent under php-sdk:api.

Release note

Adds .changes/unreleased/Added-20260824-175048.yaml, attributed to source PR #13462.

sipsma and others added 3 commits August 24, 2026 17:19
Signed-off-by: Erik Sipsma <[email protected]>
(cherry picked from commit 49b99b6)
Signed-off-by: Erik Sipsma <[email protected]>
* feat(engine): add SSHFS-backed volumes

Introduce an opaque Volume object backed by SSHFS, letting workflows mount a
remote filesystem (over SSH/SFTP) into containers. This enables using large or
externally-managed filesystems in Dagger pipelines without copying them into
the engine's content store.

API
- New opaque `Volume` object type. Only its `id` is exposed; the backing
  endpoint, credentials, and SSHFS specifics are never surfaced to clients.
- `Container.withMountedVolume(path, volume, readOnly=false, expand=false)`
  mounts a volume into a container. Removal uses the existing
  `Container.withoutMount`.
- `Query.sshfsVolume(endpoint, privateKey, knownHosts, cacheKey,
  insecureSkipHostKeyCheck=false, experimentalServiceHost)` constructs an
  SSHFS-backed volume.
- `Address.volume` constructs a volume from an address string such as
  `sshfs://user@host[:port]/abs/path?privateKey=env://KEY&knownHosts=env://KNOWN`
  for CLI and non-SDK use; the CLI gains a custom `Volume` argument flag.

Module boundary
- Modules can accept, pass, and mount Volume values, but cannot construct SSHFS
  volumes. `Query.sshfsVolume` and `Address.volume` are constructors for the
  main (outside) client only: they are hidden from module SDK introspection via
  field-level scrubbing and runtime-gated with RequireMainClient. The `Volume`
  type itself and `Container.withMountedVolume` remain available to modules.

Implementation
- `core.Volume` carries a private backend config (SSHFSVolumeConfig) holding the
  endpoint plus the private-key and known_hosts Secrets and an optional
  experimental service host, all attached as dagql dependencies.
- At exec time the engine establishes the SSHFS mount: secrets are materialized
  only to per-mount tmpfs files, sshfs is invoked, and the result is
  bind-mounted into the container; the mount and temp state are cleaned up after
  use.
- `experimentalServiceHost` dials a Dagger service as the endpoint while still
  verifying the original endpoint host's key via OpenSSH HostKeyAlias.
- New public API is version-gated with AfterVersion("v1.0.0-0").

Security
- Host-key verification is secure by default: `knownHosts` is required unless
  `insecureSkipHostKeyCheck` is explicitly true.
- Private keys and known_hosts are attached as Secret dependencies and are never
  written to the persisted cache; persisted volumes record only handle-form
  references and config, never key material or a live mount path.
- The dev engine image installs sshfs and fuse3 and enables `user_allow_other`
  in /etc/fuse.conf so non-root container users can read the FUSE mount.

Cache semantics
- Default volume identity is per-session input, avoiding accidental
  cross-session reuse. Users may pass `cacheKey` to opt into equivalence across
  matching constructor calls; identity is never derived from remote contents.
- A cached exec is not re-run and therefore does not reread remote contents: an
  identical exec recipe returns the cached result even after the remote data
  changes, while a fresh/cache-busted exec observes new contents.

Includes generated SDK, schema, and reference doc outputs from `dagger generate`.

Validation
- go test ./cmd/codegen/introspection ./core ./core/schema
- (cd toolchains/engine-dev && go test ./build)
- dagger call engine-dev test --pkg ./core/integration --run TestVolume
- dagger call engine-dev test --pkg ./cmd/dagger --run 'TestVolume(CustomFlagValue|SliceCustomFlagValue)'
- dagger call go-sdk generate diff-stats

Signed-off-by: Erik Sipsma <[email protected]>
Co-authored-by: Geoff Wilson <[email protected]>
Co-authored-by: Nikola Jokic <[email protected]>

* lint: suppress persisted container complexity

The SSHFS volume mount support added another branch to the persisted container encode/decode dispatch, which pushed both functions just over the gocyclo threshold in CI. These functions intentionally centralize persisted container mount, secret, and socket serialization, so suppress the complexity lint at the function boundary with scoped explanations.

Signed-off-by: Erik Sipsma <[email protected]>

* engine: update bundled sshfs to 3.7.6

Signed-off-by: Erik Sipsma <[email protected]>

* engine: harden SSHFS credential and cleanup handling

Signed-off-by: Erik Sipsma <[email protected]>

* test: update hidden fields for SSHFS volume constructors

Signed-off-by: Erik Sipsma <[email protected]>

---------

Signed-off-by: Erik Sipsma <[email protected]>
Co-authored-by: Geoff Wilson <[email protected]>
Co-authored-by: Nikola Jokic <[email protected]>
(cherry picked from commit 903e583)
Signed-off-by: Erik Sipsma <[email protected]>
Open the API at v0.21.9, use the maintenance-line integration fixture helpers, regenerate SDK and reference outputs, and add the release note.

Also include the applicable lint compatibility from e17f17d so the DagQL staticcheck suppression does not flap under the current pinned linter.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma requested review from a team as code owners August 24, 2026 18:15
@sipsma sipsma added this to the v0.21.9 milestone Aug 24, 2026
@sipsma
sipsma merged commit 7305acb into dagger:backport-0.21 Aug 24, 2026
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants