GeezerVison is showing github.com — Inject git commit info in CLI build by shykes · Pull Request #13508 · dagger/dagger
Conversation
shykes
commented
Jun 18, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
NOTE: The test-cache-persistence fix (#13700) is merged to main, but CI runs against the pinned engine v1.0.0-beta.6, which predates it. That check stays red until CI runs an engine that actually contains #13700 — either deploy a build from a commit that includes it, or wait for v1.0.0-beta.8 and bump engineVersion to it.
Problem
dagger version printed a blank commit and dirty state:
commit: unknown
dirty: no
The CLI and engine are built inside the Dagger sandbox, which has no .git. Normally go build records the commit and dirty state from the local git checkout — with no .git, that comes out empty.
Solution
The Go build toolchain now reads the git HEAD and dirty state from the caller's Workspace and passes them to go build via -ldflags, matching what a native build records.
Engine bump
We use Workspace.git(), which only exists in the 1.0 engine, so the CI toolchain modules bump to v1.0.0-beta.6. Almost the entire diff is regenerated API clients from that bump, not hand-written code.
Checks
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
shykes
changed the title
Inject git metadata into CLI build
Fix blank commit info in dagger version
Jul 18, 2026
shykes
changed the title
Fix blank commit info in dagger version
Inject git commit info in CLI build
Jul 18, 2026
shykes
added a commit
to dagger/go
that referenced
this pull request
Jul 18, 2026
No longer needed: the dagger repo inlined its own copy
(dagger/dagger#13508) and is moving to stamp VCS metadata into
native build info directly. No consumers remain.
shykes
added a commit
to dagger/go
that referenced
this pull request
Jul 20, 2026
No longer needed: the dagger repo inlined its own copy
(dagger/dagger#13508) and is moving to stamp VCS metadata into
native build info directly. No consumers remain.
Needed for Workspace.git(), which we can use to simplify and speed up our builds, and better showcase what a great Dagger setup can achieve.
The diff is mostly module codegen.
Signed-off-by: Solomon Hykes <[email protected]>
buildinfo is a small wrapper for injecting git metadata into a binary
via -ldflags. We need it because our build runs inside the Dagger sandbox,
without the full .git directory available, which breaks Go's native buildinfo.
Initially we planned on making this helper available to other Go projects, so they too
can sandbox their builds in Dagger without losing vcs metadata. But, we have found a better
solution (instrument 'git' command to inject straight into native buildinfo - not yet implemented).
We no longer plan on making the buildinfo package public. So we're inlining it here.
There are no orthogonal edits - just the code move.
Signed-off-by: Solomon Hykes <[email protected]>
Fix `dagger version` printing a blank commit and dirty state. The CLI
and engine are built inside the Dagger sandbox, which has no .git, so the
git detection `go build` normally does comes up empty.
Instead, this reads the git HEAD and dirty state from the caller's
Workspace and passes them to `go build` via -ldflags, matching what a
native build would record.
Uses the new Workspace.git() API introduced in v1.0.0-beta
Signed-off-by: Solomon Hykes <[email protected]>
The previous approach stored the auto-injected Workspace as a field on
EngineDev (and Builder), and passed it down to the go/cli-dev toolchains.
Because a module object's cache key is its field values, holding a
session-scoped Workspace tainted the cache key of *every* EngineDev
method — so their build results could not be reused across a session or
an engine restart.
Resolve the Workspace to scalar commit/dirty values once, at the point
where it is auto-injected, and thread only those strings through the
toolchains. No module stores or receives a Workspace object for stamping
anymore, so builds stay content-addressed. go/cli-dev gain optional
vcsCommit/vcsDirty args (which take precedence over ws); dev/docs-dev/
release are unchanged and keep passing the Workspace, which is now
resolved to scalars internally.
Regenerated the affected dagger runtime bindings.
Note: cross-restart cache persistence for git-touching builds also
requires WorkspaceGit to be persistable in the dagql disk cache, fixed
separately in #13700.
Signed-off-by: Solomon Hykes <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|