Repository navigation
Add SSHFS-backed volumes - #13462
Merged
Merged
Add SSHFS-backed volumes#13462
Conversation
Contributor
Author
|
cc @suprjinx |
|
Thank you @sipsma this looks good from our perspective! I have been able to test the capability, and it seems to work nicely; although we can't test it at scale just yet as our build for this contains other changes (which look dagger v1 related) that we're not ready to ship just yet. All the choices you've made make sense to me as well.
out of curiosity isn't that the case already for http calls in modules? how is the sshfs case different? |
Contributor
|
@sipsma we think this is going to work great for us, so do please 🚢 it :-) |
sipsma
force-pushed
the
sshfs-thread-202606091733
branch
2 times, most recently
from
July 20, 2026 23:51
a63eb7a to
f052627
Compare
sipsma
marked this pull request as ready for review
July 20, 2026 23:55
grouville
approved these changes
Jul 21, 2026
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]>
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]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
sshfs-thread-202606091733
branch
from
July 21, 2026 17:37
cd5f3ef to
5500d33
Compare
sipsma
added a commit
that referenced
this pull request
Aug 24, 2026
* core: add field-level schema introspection scrubbing Signed-off-by: Erik Sipsma <[email protected]> (cherry picked from commit 49b99b6) Signed-off-by: Erik Sipsma <[email protected]> * Add SSHFS-backed volumes (#13462) * 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]> * chore: adapt SSHFS volumes for v0.21 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]> --------- Signed-off-by: Erik Sipsma <[email protected]> Co-authored-by: Geoff Wilson <[email protected]> Co-authored-by: Nikola Jokic <[email protected]>
This was referenced Aug 31, 2026
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
dagger 0.21.9 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## v0.21.9 - 2026-08-25 ### Added - Added SSHFS-backed volumes, allowing remote filesystems to be mounted into containers without copying their contents into Dagger's content store by @sipsma in dagger/dagger#13462 ### Fixed - `Container.withDirectory` and `Directory.withDirectory` no longer restore by @sipsma in dagger/dagger#13848 \ deleted nested files after execs remove and recreate an ancestor directory. - Engine client enumeration no longer blocks behind another session's by @sipsma in dagger/dagger#13542 \ initialization or teardown, preventing Cloud keeper heartbeats from stalling and live engines from being suspended. - Session teardown now runs in the background after the main client disconnects, by @sipsma in dagger/dagger#13681 \ preventing shutdown responses from timing out while the engine releases session-owned cache results. - The engine now bounds retained DAGQL cache metadata independently of disk by @sipsma in dagger/dagger#13846 \ usage by pruning cold persisted results when the structural estimate exceeds its configured limit. This may mitigate metadata growth at scale while preserving active and engine-lifetime cache roots. - Registry protocol probes no longer appear as scary errors in progress output by @vito in dagger/dagger#13410 \ when image pulls or publishes succeed, while genuine registry failures remain visible. - Registry authentication no longer invalidates downstream container cache reuse across sessions when applied before or after `Container.from` by @sipsma in dagger/dagger#13901 ### What to do next? - Read the [documentation](https://docs.dagger.io) - Join our [Discord server](https://discord.gg/dagger-io) - Follow us on [Twitter](https://twitter.com/dagger_io) </pre> <p>View the full release notes at <a href="https://github.com/dagger/dagger/releases/tag/v0.21.9">https://github.com/dagger/dagger/releases/tag/v0.21.9</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17786
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.
Goal
Let Dagger workflows mount a remote filesystem over SSH/SFTP into containers, without first copying it into the engine's content store. This is aimed at large or externally-managed datasets where snapshotting the whole tree into the cache is impractical or undesirable, and where you want a live, two-way view of a remote path.
The feature is exposed as a new opaque
Volumeobject. "Opaque" is deliberate: aVolumeonly exposes itsid. The backing endpoint, credentials, and the fact that it's SSHFS at all are never surfaced to clients. This keeps the door open for other volume backends later without an API break, and—more importantly—lets aVolumebe handed to module code as a capability without leaking how it's wired up.What this adds
Volume— new opaque object type (onlyidis exposed).Container.withMountedVolume(path, volume, readOnly = false, expand = false)— mounts a volume into a container. Removal is handled by the existingContainer.withoutMount.Query.sshfsVolume(endpoint, privateKey, knownHosts, cacheKey, insecureSkipHostKeyCheck = false, experimentalServiceHost)— constructs an SSHFS-backed volume (main client only).Address.volume— constructs a volume from ansshfs://…address string (main client only), so CLI/non-SDK callers can pass a volume as a single argument. The CLI gains a customVolumeargument flag that resolves through this.New public API is version-gated (
AfterVersion("v1.0.0-0")), and generated SDKs / schema / reference docs are included.Approach
core.Volumecarries a private backend config (SSHFSVolumeConfig): the endpoint plus the private-key andknown_hostsSecrets and an optional experimental service host. The secrets/service are attached as normal dagql dependencies, so they participate in identity, lifecycle, and persistence like any other resource a container depends on.sshfs, bind-mounts the result into the container, and tears everything (mount, tmpfs, any service) down afterwards.RequireMainClient, so the constructors are genuinely unavailable to module code whileVolume/withMountedVolumestay available.Usage
In a module: accept and mount a
VolumeA module never constructs the volume—it receives one and mounts it. This keeps modules portable across environments:
From the CLI: pass a volume by address
The CLI (a main client) resolves the
sshfs://…address into aVolumeand passes it to the module function. Secrets are referenced with the usual secret URIs (e.g.env://,file://,op://, …):Supported query params:
privateKey(required),knownHosts,cacheKey,insecureSkipHostKeyCheck. If a nested secret address itself contains query characters, URL-encode it.Constructing directly (main client / SDK)
Module portability (why constructors are main-client-only)
Modules are meant to be environment-agnostic and reusable. A module that could call
dag.sshfsVolume(...)(ordag.address("sshfs://...").volume()) would be able to bake host names, ports, and SSH wiring into its own code, which couples it to one environment and lets it reach out to arbitrary endpoints on its own. Instead, only the outside/main client constructs volumes; modules just declare aVolumeparameter and mount whatever they're handed. The opacity ofVolumereinforces this—module code cannot inspect or reconstruct the SSH details of a volume it receives.Differences from #12049
This reworks the earlier #12049 (which implemented both SSHFS and host directory mounts). It was not copied; it was rebuilt from scratch, reusing only the pieces that held up under review. Meaningful differences:
Queryand was reachable from module code. Here the constructors are main-client-only (field-hidden from module introspection and runtime-gated viaRequireMainClient), for the portability reasons above. A newAddress.volumepath is added for CLI/address use and is gated the same way.known_hostsmaterial is materialized only to per-mount tmpfs at use time and scrubbed afterward; secrets are tracked as dependencies and persisted only in handle form (never the contents).StrictHostKeyChecking=no,UserKnownHostsFile=/dev/null). Here,knownHostsis required unlessinsecureSkipHostKeyCheckis explicitly set, andStrictHostKeyCheckingis on. WhenexperimentalServiceHostis used, the connection dials the service while verification stays anchored to the user-facing endpoint host via OpenSSHHostKeyAlias.Cache behavior
cacheKeyto opt into equivalence across matching constructor calls (the user asserts "these are the same volume"); resource-dependency requirements still apply.Security notes
knownHostsrequired by default; insecure skip is an explicit, opt-in flag.known_hostsnever touch stable disk and are never persisted as content.sshfsandfuse3and enablesuser_allow_otherin/etc/fuse.confso non-root container users can read the FUSE mount.Tests & 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— covers an end-to-end SSHFS mount/read, RW write + cached-read-does-not-reread, wrong-known_hostsrejection (with a positive control), a module accepting/mounting a volume, and a module being unable to construct one.dagger call engine-dev test --pkg ./cmd/dagger --run 'TestVolume(CustomFlagValue|SliceCustomFlagValue)'dagger call go-sdk generate diff-statsGenerated outputs
Generated SDK clients (Go/Python/TypeScript/Rust/Elixir/PHP), the GraphQL schema doc, and the PHP static reference are included from
dagger generate. Constructor hiding is consistent across them: client SDKs exposesshfsVolume/Address.volume, while module SDKs do not.