Repository navigation
go: build for a target platform on any machine, with fewer engine requests per module load (needs Dagger v1.0.0-beta.26) - #100
Merged
Conversation
What a build compiles for a target is the same whichever machine's Go toolchain compiles it, so each build is declared as made for its target (Directory.withPlatform): an engine of the target's platform finds the builds an engine of another platform made for it, such as the ones an engine image built on another platform ships. - archives and archiveBuilds take the platform they compile for, the engine's when unset. - Each package's build, but a cgo package's, whose C compiler is the machine's, and each module download are declared for the build's target. - A package's script runs the toolchain's tools from its tool directory for the machine the exec runs on, which it reads from the toolchain, instead of the plan's, which names the machine that made the plan. - gohdr, pack and golangci-lint's write-manifest are built for every machine an engine runs on, each into one directory with a script that runs the exec's machine's: a build mounts the same tools on every machine. - The includes helper is built for the engine's platform by any machine's toolchain, and declared for it. - archiveBuilds' tool and manifestTool are those gohdr and write-manifest directories, and its new helperBinary is the includes helper for the builds' platform: what an engine image of that platform ships. Signed-off-by: Erik Sipsma <[email protected]>
…r a given platform gobuild requires dagger.io/dagger v1.0.0-beta.26, the release it targets, and replaces it with v1.0.0-beta.25 until that release publishes its library; its generated entrypoint is regenerated for the target. Signed-off-by: Erik Sipsma <[email protected]>
A package's script went in as a file made for it and mounted, and the client asked the engine for that file's ID in a request of its own before the step's request could mount it: one request and two calls more for every package. On the exec's standard input, the script is part of the exec's own call. Signed-off-by: Erik Sipsma <[email protected]>
v1.0.0-beta.26's dagger.io/dagger library isn't published yet, and gobuild needs its bindings, such as Directory.withPlatform and File.sync's keyByContent. Until the release, gobuild builds with that library as the engine's pull request has it, as a Go module at a fixed commit. The follow-up pull request after the release requires the published library. Signed-off-by: Erik Sipsma <[email protected]>
Each package's build, each module download and each tool directory is declared for its target with the library's Directory.withPlatform, in the same query that builds it, instead of asking the engine for the result's ID and then sending a query of its own for the declaration: two requests for every package, cached or not. Signed-off-by: Erik Sipsma <[email protected]>
A package's step evaluated its exec's output directory in one request and read its archive from it in a second, so that the archive was keyed by its content. File.sync's keyByContent keys it in the request that runs the exec, so each dependency level of a build waits on one request, not two. The link object a split package's link reads is keyed the same way, still after its importers start. Signed-off-by: Erik Sipsma <[email protected]>
…writes A package's script went to its exec on its standard input, which the step's title shows, so a failed compile's title was the whole script. The step's container now writes it as a file in the step's own query, and the exec names the package, as before the script went to standard input, still without the request a mounted file object cost for its ID. Signed-off-by: Erik Sipsma <[email protected]>
…eeps returned IDs The engine's pull request now has core.Loaded, which builds an object from an ID the engine returned knowing it, and go-sdk's bindings use it for the core objects a request returns, for modules that target v1.0.0-beta.26. gobuild builds with that library and is generated by that go-sdk, so each File a list field of its own returns keeps its ID. Signed-off-by: Erik Sipsma <[email protected]>
Every load of a Go module walked every package its build compiles, the standard library and dependencies included, with a request or two to the engine for each, even when every package was cached: about 1,300 requests of a warm load's 1,900. The packages that read none of the build's source and import nothing that does are now built by Dependencies, which the build calls through the engine with exactly what they read: their nodes by their stable names, the base, the tools, the platform and the downloaded modules' directories. The engine caches the call, so every build that compiles the same dependencies the same way finds them in one call, whatever its own source, and an edit of that source leaves the call as it is. Inside the call, each package is still its own exec, keyed by what it reads, so a new dependency set re-runs only what changed. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
…ovides The build follows a dependency's import of a package of its own source into the source, and never downloads the module version go.sum may also name for it. The discovery call has no source, so it followed such an import into that version, and a download that failed there, of a version no longer served or with no network, failed a build that discovers on its own. The call is now given the source's modules that go.sum may provide a package of, nearly always none, so its key stays the same for every module with the same dependencies; it neither downloads nor follows their packages, and reports them as followed, and the build then discovers on its own, as it does when the call followed a package of its source. Signed-off-by: Erik Sipsma <[email protected]>
…n module A dependency's package that imports one of the project's own packages is built with the project's, which the build reaches only by following the import into its source. The check builds such a project from a file proxy, and again with a go.sum that also names a version of the project's module that no proxy serves, which the build must not download. Signed-off-by: Erik Sipsma <[email protected]>
Since dagger/dagger#15088, `dagger check` reports a collection's items under one check: the report's top CHECKS header counts the collection once, and the items' totals move to the CHECKS header nested under it. The selected-test checks compared the top header with the items' totals, so 11 of them failed on an engine with that change even though every item reported the expected result. Accept both layouts: the released engines' flat report, whose one top header tallies the items, and the grouped one, whose top header shows one collection check, passed only when every item passed, with exactly one header nested under it that tallies the items. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
v1.0.0-beta.26 is released, and its dagger.io/dagger library is published, so gobuild requires it as it is and the replace that stood in for it, the library from the release's pull request, goes. The workspace pins go-sdk at the commit its pull request merged as, which generates gobuild's files as the earlier pin did; regenerating changes only go.sum and the lock, which records the sdk-helpers release that go-sdk now uses. Signed-off-by: Erik Sipsma <[email protected]>
v1.0.0-beta.26's dagger check groups a collection's items under its check as main's report does, but its top header counts the items again, not the one collection check. checkSummaryMatches read only the two layouts before it, so every selected test check failed on that release with the totals it expected. A grouped report's top header may now count either. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
tiborvass
approved these changes
Nov 10, 2026
sipsma
added a commit
to dagger/dagger
that referenced
this pull request
Nov 10, 2026
The engine image's entries call each Go module's prebuild with the platform it builds for, which dagger/go's gobuild takes since its per-platform build merged (dagger/go#100). The built-in Go SDK pinned a dagger/go main from before that merge, whose prebuild takes no platform, so the entries failed. It now pins dagger/go's main with that merge and with gomod's beta.26 type names kept distinct (dagger/go#102), and go-sdk moves to the commit that names the same dagger/go (dagger/go-sdk#103), as the entries require. The workspace's own dagger/go module stays where it was: the checks' engine loads it, and that engine is older than the per-platform build needs. Signed-off-by: Erik Sipsma <[email protected]>
dagger-ci
pushed a commit
to dagger/dagger-go-sdk
that referenced
this pull request
Nov 10, 2026
The engine image's entries call each Go module's prebuild with the platform it builds for, which dagger/go's gobuild takes since its per-platform build merged (dagger/go#100). The built-in Go SDK pinned a dagger/go main from before that merge, whose prebuild takes no platform, so the entries failed. It now pins dagger/go's main with that merge and with gomod's beta.26 type names kept distinct (dagger/go#102), and go-sdk moves to the commit that names the same dagger/go (dagger/go-sdk#103), as the entries require. The workspace's own dagger/go module stays where it was: the checks' engine loads it, and that engine is older than the per-platform build needs. Signed-off-by: Erik Sipsma <[email protected]>
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.
Builds with this module can target a platform other than the machine's, and a Go module load sends the engine far fewer requests. This needs Dagger v1.0.0-beta.26: gobuild targets that release and builds with its published
dagger.io/daggerlibrary, so an older engine can't load it.These changes were waiting on v1.0.0-beta.26, which ships the engine fields they use. They follow #95.
Builds for a target platform on any machine
packand the archives'write-manifest) for every machine an engine runs on, and declares what it builds for its target platform (Directory.withPlatform). So a build made on one platform is found by an engine of another that builds for the same target, such as an engine image for arm64 prepared on amd64.archiveBuildstakes theplatformit builds for.GoArchiveBuildsreturns gohdr andwrite-manifestfor every machine, as directories, and gainshelperBinary, the includes helper for that platform.archiveBuildsfrom go: per-package builds that share module downloads and plans, with faster edits, lints and gobuild loads #95, this is what dagger/dagger's engine images use to ship each platform's pre-warmed cache. It also ends the intermittent "missing shared result" those images hit.Fewer requests per module load
Also
dagger checkreport. That report groups a collection's items under their check, and its top header counts the items again.Merging
Please merge this with a merge commit. Dagger v1.0.0-beta.26's built-in Go SDK builds with a commit in this branch's history, the one tagged
pin/dagger-v1.0.0-beta.26. A merge commit makes it part of main.Testing
dagger generatechanges nothing: gobuild's generated files are what the pinned go-sdk generates.