Skip to content

VERSION files + buildinfo-based VCS info (discussion #13287) - #13313

Merged
tiborvass merged 5 commits into
mainfrom
better-version-strings
Jul 2, 2026
Merged

tiborvass merged 5 commits into
mainfrom
better-version-strings

Conversation

@shykes

@shykes shykes commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Implements the version/build identity foundation from discussion #13287.

This replaces the old Dagger version module and its git-tag-walking logic with build identity embedded in the binaries themselves. Native Go builds use the VCS metadata already stamped by the Go toolchain; sandboxed Dagger Go builds inject the same metadata through github.com/dagger/go/buildinfo ldflags.

What changes

  • Add internal/version, which embeds internal/version/VERSION and exposes Version, Commit, Dirty, CommitTime, and Canonical().
  • Add github.com/dagger/go/buildinfo as the wrapper around runtime/debug.ReadBuildInfo, with injectable -ldflags vars for sandboxed builds.
  • Remove the standalone /version Dagger module and stop deriving versions by walking tags, merge-bases, or source digests inside Dagger.
  • Teach toolchains/go to accept a GitRepository input and stamp VCS metadata into binaries it builds.
  • Keep engine.Version and engine.Tag as the public version surfaces used by the CLI, engine, SDK defaults, and release code.
  • Keep release pipelines able to override engine.Version and engine.Tag via ldflags.
  • If engine.Tag is not explicitly set, derive it from the build identity:
    • release build -> engine.Version
    • dev build with commit -> commit
    • dev build without commit -> main
  • Change dagger version to a labeled output while preserving the existing operational fields.

Output

$ dagger version
version:     v0.21.3
commit:      3059ea74
dirty:       yes
platform:    linux/amd64
runner-host: image://registry.dagger.io/engine:v0.21.3

$ dagger version -q
v0.21.3+3059ea74.dirty

Why

The old version path mixed several responsibilities: user-facing version strings, engine image tags, git history inspection, source digests, and release metadata. That made version calculation slower, harder to reason about, and dependent on Dagger runtime behavior even though the result is fundamentally build identity.

This PR moves build identity to the binary build step, where Go already has a standard mechanism for VCS metadata. The same identity model now works for native go build and sandboxed Dagger builds, while preserving the existing engine.Version / engine.Tag surfaces for callers that still rely on them.

Not in this PR

  • No release-by-promotion redesign or release manifest work.
  • No Helm chart VERSION change.
  • No SDK migration work beyond regenerated bindings needed for this branch.
  • No switch to Workspace.git; toolchains/go keeps a TODO for that once available.
  • No commit-time injection beyond what is already available from Go build info.
  • No broader engine.IsDevVersion cleanup beyond recognizing v1.0.0-dev style prereleases.

Refs: discussion #13287, #13074 (Workspace.git), #13086 (GitCommit proposal).

@tiborvass
tiborvass force-pushed the better-version-strings branch 3 times, most recently from 1e1f733 to dfa29b4 Compare June 4, 2026 16:41
@dagger-codex
dagger-codex Bot force-pushed the better-version-strings branch 2 times, most recently from 4930c51 to 279cfcc Compare June 4, 2026 18:36
@dagger-codex
dagger-codex Bot force-pushed the better-version-strings branch 8 times, most recently from 068cf04 to 43992fa Compare June 9, 2026 20:05
@tiborvass
tiborvass force-pushed the better-version-strings branch 2 times, most recently from 5991dc1 to 6fae47d Compare June 10, 2026 05:46
shykes added a commit that referenced this pull request Jun 18, 2026
#13313 removed cli-dev's imageTag arg but left this dangling ref, so
release didn't build. Isolated so it can drop if fixed upstream.

Signed-off-by: Solomon Hykes <[email protected]>
shykes added a commit that referenced this pull request Jun 18, 2026
#13313 removed cli-dev's imageTag arg but left this dangling ref, so
release didn't build. Isolated so it can drop if fixed upstream.

Signed-off-by: Solomon Hykes <[email protected]>
@shykes
shykes force-pushed the better-version-strings branch from 428c01a to e046ccd Compare June 18, 2026 10:46
shykes added a commit that referenced this pull request Jun 18, 2026
#13313 removed cli-dev's imageTag arg but left this dangling ref, so
release didn't build. Isolated so it can drop if fixed upstream.

Signed-off-by: Solomon Hykes <[email protected]>
@shykes
shykes force-pushed the better-version-strings branch from e046ccd to 419f54d Compare June 18, 2026 15:00
@shykes
shykes force-pushed the better-version-strings branch from 419f54d to 0d114cc Compare June 18, 2026 17:33
@shykes
shykes marked this pull request as ready for review June 18, 2026 18:20
@shykes
shykes requested a review from a team as a code owner June 18, 2026 18:20
@shykes
shykes force-pushed the better-version-strings branch from 0d114cc to 5c7dc48 Compare June 18, 2026 18:20
@shykes

shykes commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

The publish-with-mock-endpoints test takes --tag v0.21.7 as the intended release version (which during an actual release would come from the git tag input), publishes the engine image under that tag, then verifies the binary inside advertises the same version via dagger-engine --version; right now that fails because --tag only affects image tags, while the binary version comes from embedded internal/version/VERSION, so it still reports v1.0.0-dev <commit>.

The possible fixes are either:

  1. reintroduce a build-time override, preferably a single internal/version ldflag rather than separate engine.Version/engine.Tag
  2. rewrite VERSION during release, which would require a clean on-the-fly commit to avoid dirty VCS metadata
  3. redesign release so the published tag is derived from the built artifact’s advertised version instead of being supplied as input.

I see.

If I understand correctly, the issue is that release does not use version, it bypasses it to read the git tag information itself - violating DRY?

@tiborvass

Copy link
Copy Markdown
Contributor

@shykes In a way yes toolchains/engine-dev/build.Builder.goWithSource was injecting engine.Version and engine.Tag ldflags, and 2 other places were doing that too (cli-dev, engine-dev.test)

@tiborvass
tiborvass force-pushed the better-version-strings branch from d702487 to 5f8b7ef Compare June 19, 2026 21:52
tiborvass pushed a commit that referenced this pull request Jun 29, 2026
#13313 removed cli-dev's imageTag arg but left this dangling ref, so
release didn't build. Isolated so it can drop if fixed upstream.

Signed-off-by: Solomon Hykes <[email protected]>
@tiborvass
tiborvass force-pushed the better-version-strings branch from 5f8b7ef to cd5b6dc Compare June 29, 2026 16:32
tiborvass pushed a commit to tiborvass/dagger that referenced this pull request Jul 1, 2026
dagger#13313 removed cli-dev's imageTag arg but left this dangling ref, so
release didn't build. Isolated so it can drop if fixed upstream.

Signed-off-by: Solomon Hykes <[email protected]>
@tiborvass
tiborvass force-pushed the better-version-strings branch from cd5b6dc to aefc69a Compare July 1, 2026 22:06
Add an internal package that embeds VERSION and reads Go build info
via github.com/dagger/go/buildinfo. It exposes the build version,
VCS revision, dirty state, and human-readable identifiers used by
later CLI and engine wiring.

Signed-off-by: Solomon Hykes <[email protected]>
Co-authored-by: Tibor Vass <[email protected]>
Signed-off-by: Tibor Vass <[email protected]>
@tiborvass
tiborvass force-pushed the better-version-strings branch 8 times, most recently from bac0ac6 to a700e58 Compare July 2, 2026 01:13
Print the CLI version from engine.Version plus the platform and,
when available, the short VCS state from internal/version. Add
-q/--quiet for the canonical build identifier and teach installer
tests that the commit state is optional trailing data.

Signed-off-by: Solomon Hykes <[email protected]>
Co-authored-by: Tibor Vass <[email protected]>
Signed-off-by: Tibor Vass <[email protected]>
@tiborvass
tiborvass force-pushed the better-version-strings branch from a700e58 to 103bb31 Compare July 2, 2026 03:26

@tiborvass tiborvass left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update:

  • dagger version keeps the v prefix.
  • dagger version includes fields that were previously shown: platform and runner-host.
  • engine.Tag remains overrideable by release pipelines via ldflags
  • If engine.Tag is empty, it is derived:
    • release build -> engine.Version
    • dev build with commit -> commit
    • dev build without commit -> main

shykes and others added 3 commits July 1, 2026 23:29
Populate engine.Version from internal/version and derive engine.Tag
from the VCS commit for dev builds while keeping release tags
version-based. Preserve the existing env override behavior and
broaden dev-version recognition for v1.0.0-dev style prereleases.

Signed-off-by: Solomon Hykes <[email protected]>
Co-authored-by: Tibor Vass <[email protected]>
Signed-off-by: Tibor Vass <[email protected]>
Drop the standalone version module and its toolchain dependencies.
Use the embedded internal/version package for runtime identity,
keep release version values as publish metadata, and pass repository
VCS state through the Go toolchain so sandbox-built binaries and
test binaries can report commit and dirty state.

Signed-off-by: Solomon Hykes <[email protected]>
Co-authored-by: Tibor Vass <[email protected]>
Signed-off-by: Tibor Vass <[email protected]>
Regenerate Dagger bindings and CLI reference output after replacing
the standalone version module with internal/version and adding
repository metadata to the Go toolchain API.

Signed-off-by: Tibor Vass <[email protected]>
Co-authored-by: Solomon Hykes <[email protected]>
Signed-off-by: Solomon Hykes <[email protected]>
@tiborvass
tiborvass force-pushed the better-version-strings branch from 103bb31 to 5b58e5e Compare July 2, 2026 06:30
@tiborvass
tiborvass merged commit 499b5fc into main Jul 2, 2026
79 checks passed
@tiborvass
tiborvass deleted the better-version-strings branch July 2, 2026 07:00
shykes added a commit that referenced this pull request Jul 2, 2026
PR #13313 merged the version-strings work with internal/version/VERSION
carrying a leading "v" (v1.0.0-dev), whereas this branch's release
tooling assumed a bare semver. targetVersion() validated with
semver.IsValid("v"+version), so a v-prefixed file produced "vv1.0.0-dev"
and the release pipeline failed to read its own version.

Strip an optional leading "v" on read. The version flows through the
pipeline bare and each sink (Helm, package-registry URLs) re-adds the
prefix where needed, so the file may now be bare or v-prefixed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
shykes added a commit that referenced this pull request Jul 3, 2026
PR #13313 merged the version-strings work with internal/version/VERSION
carrying a leading "v" (v1.0.0-dev), whereas this branch's release
tooling assumed a bare semver. targetVersion() validated with
semver.IsValid("v"+version), so a v-prefixed file produced "vv1.0.0-dev"
and the release pipeline failed to read its own version.

Strip an optional leading "v" on read. The version flows through the
pipeline bare and each sink (Helm, package-registry URLs) re-adds the
prefix where needed, so the file may now be bare or v-prefixed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Solomon Hykes <[email protected]>
shykes added a commit that referenced this pull request Jul 6, 2026
PR #13313 merged the version-strings work with internal/version/VERSION
carrying a leading "v" (v1.0.0-dev), whereas this branch's release
tooling assumed a bare semver. targetVersion() validated with
semver.IsValid("v"+version), so a v-prefixed file produced "vv1.0.0-dev"
and the release pipeline failed to read its own version.

Strip an optional leading "v" on read. The version flows through the
pipeline bare and each sink (Helm, package-registry URLs) re-adds the
prefix where needed, so the file may now be bare or v-prefixed.

Signed-off-by: Solomon Hykes <[email protected]>
shykes added a commit that referenced this pull request Jul 6, 2026
PR #13313 landed internal/version/VERSION with a leading "v" (v1.0.0-dev),
but this branch's release tooling assumed a bare semver. targetVersion()
validated with semver.IsValid("v"+version), so a v-prefixed file produced
"vv1.0.0-dev" and the release pipeline failed to read its own version.

Strip an optional leading "v" on read. The version flows through the
pipeline bare and each sink (Helm, package-registry URLs) re-adds the
prefix where needed, so the file may now be bare or v-prefixed.

Signed-off-by: Solomon Hykes <[email protected]>
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