GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Inject git commit info in CLI build by shykes · Pull Request #13508 · dagger/dagger

Conversation

@shykes

@shykes shykes commented Jun 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

  • test-split:test-cache-persistence — we use Workspace.git(), which has a cache-invalidation bug. Fixed in core: make WorkspaceGit persistable in the dagql disk cache #13700 (see NOTE above).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shykes
shykes force-pushed the better-version-strings branch from 419f54d to 0d114cc Compare June 18, 2026 17:33
@shykes
shykes force-pushed the ci-use-workspace-git branch from fcf2a46 to ac340af Compare June 18, 2026 17:33
@shykes
shykes force-pushed the better-version-strings branch from 0d114cc to 5c7dc48 Compare June 18, 2026 18:20
@shykes
shykes force-pushed the ci-use-workspace-git branch from ac340af to ab283be Compare June 18, 2026 18:20
@tiborvass
tiborvass force-pushed the better-version-strings branch from d702487 to 5f8b7ef Compare June 19, 2026 21:52
@tiborvass
tiborvass force-pushed the better-version-strings branch 12 times, most recently from 103bb31 to 5b58e5e Compare July 2, 2026 06:30
Base automatically changed from better-version-strings to main July 2, 2026 07:00
@vito vito mentioned this pull request Jul 2, 2026
core: support submodule and worktree checkouts for contextual git args #13577
Merged
@tiborvass tiborvass self-assigned this Jul 16, 2026
@shykes
shykes force-pushed the ci-use-workspace-git branch 4 times, most recently from f1482db to 4c0f4ef Compare July 18, 2026 14:39
@shykes shykes mentioned this pull request Jul 18, 2026
Remove buildinfo package dagger/go#34
Merged
@shykes
shykes force-pushed the ci-use-workspace-git branch 5 times, most recently from 3b051bf to 8c6376c Compare July 18, 2026 18:03
@shykes shykes changed the title Inject git metadata into CLI build Fix blank commit info in dagger version Jul 18, 2026
@shykes shykes changed the title Fix blank commit info in dagger version Inject git commit info in CLI build Jul 18, 2026
@shykes
shykes requested review from grouville, kpenfound, marcosnils, sipsma, tiborvass and vito July 18, 2026 18:20
@marcosnils
marcosnils force-pushed the ci-use-workspace-git branch from c7621bf to 3b6bb71 Compare July 18, 2026 18:36
vito
vito approved these changes Jul 18, 2026
View reviewed changes
shykes added a commit to dagger/go that referenced this pull request Jul 18, 2026
@shykes
Remove buildinfo package
a321d70
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
shykes force-pushed the ci-use-workspace-git branch from 3b6bb71 to f95951b Compare July 20, 2026 12:45
shykes added a commit to dagger/go that referenced this pull request Jul 20, 2026
@shykes
Remove buildinfo package
d1c493d
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.
tiborvass
tiborvass approved these changes Jul 20, 2026
View reviewed changes
@shykes shykes mentioned this pull request Jul 21, 2026
core: make WorkspaceGit persistable in the dagql disk cache #13700
Merged
@shykes
shykes force-pushed the ci-use-workspace-git branch 2 times, most recently from 29e6631 to 627735a Compare July 21, 2026 15:46
shykes added 4 commits July 22, 2026 16:06
@shykes @marcosnils
CI: bump some Dagger modules to require engine v1.0.0-beta.6
fdaae6a
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]>
@shykes @marcosnils
internal/version: move buildinfo into this repo
2fce24e
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]>
@shykes @marcosnils
stamp git info into sandboxed Go builds
1025832
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]>
@shykes @marcosnils
stamp VCS via resolved scalars, not a stored Workspace field
43d3c24
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]>
@marcosnils
marcosnils force-pushed the ci-use-workspace-git branch from 627735a to 43d3c24 Compare July 22, 2026 19:06
@marcosnils marcosnils assigned marcosnils and unassigned tiborvass Jul 22, 2026
@marcosnils
marcosnils force-pushed the ci-use-workspace-git branch from 927e788 to 6dcd814 Compare July 23, 2026 03:22
@marcosnils
pass workspace object to dependencies
0c1e2ad
Signed-off-by: Marcos Lilljedahl <[email protected]>
@marcosnils
marcosnils force-pushed the ci-use-workspace-git branch from 6dcd814 to 0c1e2ad Compare July 23, 2026 03:38
marcosnils
marcosnils approved these changes Jul 23, 2026
View reviewed changes
@marcosnils
marcosnils merged commit d7ed8bd into main Jul 23, 2026
87 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@marcosnils
marcosnils deleted the ci-use-workspace-git branch July 23, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vito vito vito approved these changes
@tiborvass tiborvass tiborvass approved these changes
@marcosnils marcosnils marcosnils approved these changes
@kpenfound kpenfound Awaiting requested review from kpenfound
@sipsma sipsma Awaiting requested review from sipsma
@grouville grouville Awaiting requested review from grouville

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@marcosnils marcosnils

Labels

None yet

Projects

None yet

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.

4 participants

@shykes @vito @tiborvass @marcosnils
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.