Repository navigation
[backport-0.21] Add SSHFS-backed volumes - #13958
Merged
Merged
Conversation
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]>
marcosnils
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backports #13462 to the v0.21 maintenance line for v0.21.9.
This adds an opaque
Volumeobject 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.sshfsVolumeandAddress.volumeremain main-client-only and are removed from module SDK introspection;VolumeandContainer.withMountedVolumeremain available to modules.Source provenance
5500d33f5a40fe4e016c387ce6f3eda8513b260e21d0fa4ae53779b94ae199fbabe24e0427b5c23a,cad82a10729e13b2bd967f14ae7ebc8584224378,32b4865880a18494dc920e6b63bc1b59e71d0e82,4385c543c47d1ac59af2650f2d0cf47aa405de22, and5500d33f5a40fe4e016c387ce6f3eda8513b260eApplied as three DCO-signed commits on exact base
00c993cbe47ba494262871052b9ab4a547989b1d:cfa395965b7c2105e8368d88aa74b4d27961f65a— field-level schema scrubbing, cherry-picked with-x -sfrom49b99b630fb81b4bf8bb2cd6bee1f9633f8b9e53, with its test adapted from mainline's Workspace API to v0.21's Directory API.9d37de1393bfe0f35dd45468fa37bf8a7f1b258e— source squash, cherry-picked with-x -sfrom903e58303ac07dff4657bcb5a697d510732e2243, with release-line conflict resolution and the narrowly required object-view pieces fromc54a8fd0003e269ad6ca4eef7604dc49e578505b.df58b82f1f507176f05d8008f193acdb5fd61611— v0.21.9 gates, release-native test helpers, current generated outputs, release note, and the applicable lint compatibility frome17f17d4a020efd59c31bc5faf301e6f1186361d.Final range:
00c993cbe47ba494262871052b9ab4a547989b1d..df58b82f1f507176f05d8008f193acdb5fd61611(3 commits, 71 files, 5,342 insertions, 213 deletions).v0.21 adaptation
v1.0.0-0API gates tov0.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.internal/cmd/dagger/daggercmdlayout to v0.21'scmd/dagger/mainlayout.Query.currentWorkspaceintrospection expectations.resolveModuleReffromAddress.volume; module-address resolution was added after v0.21 and is not required for SSHFS address parsing on this line.Volumetype and generated fields out of older schema views.fscopy,goGitBase, andwithModuleFixturehelpers.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=1dagger call engine-dev test --pkg ./core/integration --run TestVolume— 6 passed, trace067e4eb974fdd5e7a31733b80fab29b3dagger call engine-dev test --pkg ./cmd/dagger --run 'TestVolume(CustomFlagValue|SliceCustomFlagValue)'— 2 passed, tracea004d770afbea8e7d0a14dbc90aee3bcgo-sdk:generate,engine-dev:generate, TypeScript client/format, Python client, Rust API client, Elixir client, PHP API, and docs references — all 9 passed--no-apply— all passed and reportedno changes to applycore— trace6a627c867607bd1aa9598dffa9d36464cmd/dagger— trace6baccc15622d3779effda52309999b3adagql— tracee95775682116f4aba485067907234ec8toolchains/engine-dev— trace92f717eadc0714e8023a69ff96784007fc9e7f3c522c1a4901f0e7668e0364f5gofmt, DCO/signoff, clean worktree, exact base ancestry, andgit diff --checkoutside generated PHP reference HTMLFirst failure and environment/tooling controls:
5f9f256c54e0f0648a9dfeaf681be76a. The equivalent release helpers above compile and the exact rerun passes all 6 tests.dagger generate -y/dagger check -lentrypoints cannot load all v0.21 toolchains: current coreChangesetidentity and Workspace/LLM APIs differ from the pinned release modules. Focused generation and direct toolchain checks above bypass that pre-existing workspace incompatibility.internal/daggerpackages (trace373d15944dce04474c11bf68c7f1a9ab). Every changed Go area passes the same pinned linter when scoped as above.git diff --checkexceptions and are idempotent underphp-sdk:api.Release note
Adds
.changes/unreleased/Added-20260824-175048.yaml, attributed to source PR #13462.