Skip to content

Write wolfi in Dang, calling alpine lazily - #7

Merged
sipsma merged 5 commits into
mainfrom
sipsma/collections-line
Nov 10, 2026
Merged

sipsma merged 5 commits into
mainfrom
sipsma/collections-line

Conversation

@sipsma

@sipsma sipsma commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

wolfi becomes a Dang module that calls alpine, so neither loading nor calling it compiles any Go. Before, every call first compiled wolfi's one Go function, about 9 s on a fresh engine, before alpine's own work could start.

Effect: this is part of the work in dagger/dagger#15080, which takes a fresh dagger -W github.com/dagger/dagger@main check -l from 24.9 s to 6.5 s. Calling wolfi directly (container with nine packages, then reading the image's PATH) on a fresh engine is about 4–5 s faster: the median and mean of six interleaved pairs, against wolfi in Go on the same alpine.

The API is unchanged. container keeps its arguments (packages, arch, extraRepositories, extraKeyURLs, overlays) with their types, optionality, descriptions and casing, and the object keeps its description, so callers' generated clients don't change. Unset arguments pass through unset, so alpine's defaults apply as before, and overlays still merge in order. The image is the same: the root filesystem's digest matches the Go wolfi's for nine packages, for git on arm64, for git with an overlay, and with no arguments.

alpine is pinned at e746b97, the merge of dagger/alpine#8 (dagger/alpine#8), which moves alpine onto go-sdk's Dang entrypoint and makes it unpack packages only when the image's files are needed.

Needs Dagger v1.0.0-beta.18 or later.

This PR first moved wolfi's Go code onto go-sdk's Dang entrypoint (with go 1.27, dagger/go v0.4.0 and a go-sdk pin). The last commit replaces the Go code entirely, so those changes no longer apply, and with no Go code the repository no longer has Go checks, including the Go test check.

The workspace installs go-sdk and generates the module with
dangEntrypoint and unifiedClients. The engine then reads wolfi's types
from internal/dagger/entrypoint/main.dang instead of compiling the
module and running it, so loading wolfi no longer builds Go. The Go
code is built only when a function is called.

The alpine dependency becomes a client of the scope, at alpine's
ec2076f on its sipsma/collections-line branch, and the module calls it
through that client instead of the global one. The scope names the
module, so the manifest keeps the name wolfi.

go.mod moves to go 1.27, the version dagger/dagger's own modules use.
dagger/go moves to v0.4.0, which runs the Go version go.mod names;
v0.1.0 always ran Go 1.26 and refuses a go 1.27 module. Running this
workspace's own checks with dagger/go v0.4.0 needs Dagger
v1.0.0-beta.22 or later.

go-sdk is pinned to 916c9a9 on its sipsma/collections-line branch.

Loading and calling the module needs Dagger v1.0.0-beta.18 or later,
for the generated entrypoint. Without an engineVersion, the module is
served at the engine's own version instead of v0.21.9.

Signed-off-by: Erik Sipsma <[email protected]>
alpine's client moves to 7103ac9, the head of dagger/alpine#8, where
Container stacks its packages lazily and unpacks them only when the
image's files are needed. alpine's API is unchanged, so only the
generated client's source links change.

Signed-off-by: Erik Sipsma <[email protected]>
wolfi's Go code was one function: call alpine with the Wolfi distro and
the caller's packages, architecture, repositories and keys, then layer
any overlay images. Calling it compiled that Go first: about 9 s on a
fresh engine, before alpine's own compile could start, because wolfi's
code is what calls alpine.

The same function in Dang compiles nothing. Its API is the same: the
container function, its arguments with their casing, descriptions and
defaults, and the object's description, so callers' generated clients
don't change. Unset arguments pass through unset, so alpine's defaults
apply as before. alpine is pinned at its commit that unpacks packages
only when an image's files are needed.

The module needs Dagger v1.0.0-beta.18 or later, as alpine does.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma sipsma changed the title Run wolfi through a generated Dang entrypoint Write wolfi in Dang, calling alpine lazily Nov 7, 2026
With the Go code gone, the workspace and its Go checks went too, so CI
had nothing to run. A Dang module, wolfi-dev, now holds the repository's
checks, installed as the workspace's main module as dagger/go installs
go-dev. containerCheck builds a container with bash through the module
and runs it, wanting Wolfi's os-release. overlayCheck layers an overlay
image and reads its file back.

Signed-off-by: Erik Sipsma <[email protected]>
alpine's dependency moves from 7103ac9, the head of dagger/alpine#8, to
e746b97, its merge into main. alpine's code is the same; only its go-sdk
pin and generated files moved between the two.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma merged commit fdec349 into main Nov 10, 2026
4 checks passed
sipsma added a commit to dagger/dagger that referenced this pull request Nov 10, 2026
wolfi moves to dagger/wolfi#7's merge and alpine to dagger/alpine#8's,
in the workspace, dagger-dev and the two modules that still pin wolfi
directly. wolfi is now written in Dang, with alpine as an ordinary
dependency, and alpine unpacks packages only when an image's files are
needed. The generated Go clients are regenerated: their APIs are the
same, only their source links and the commits they name change.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma deleted the sipsma/collections-line branch November 10, 2026 20:13
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