Repository navigation
Commit e97da8a
authored
Log build info on startup in every run mode (#406)
Emit a single "Duckgres build info." slog line right after logging is
initialized, tagged with the run mode (standalone / control-plane /
duckdb-service / ...). This makes it trivial to grep a K8s worker's
logs and confirm which image it's actually running — especially useful
when correlating a bug to a specific commit across many worker pods.
version/commit/date have existed as ldflag-set package vars for a while
(Dockerfile, release workflow and justfile all pass -X flags), but only
the standalone path referenced them, and only `version`. The control
plane and duckdb-service workers never surfaced build info at all.
The ldflags-based flow stays authoritative. When the binary is built
without ldflags (local `go run`, `go build`, editor runs) enrichBuildInfo
backfills commit and date from runtime/debug.BuildInfo VCS settings
(Go 1.18+ embeds these automatically from the surrounding git checkout)
and appends "-dirty" when vcs.modified is true. The fallback only fires
when ldflags left the sentinel values in place — a release-built binary
with an explicit -X main.commit never gets mutated.
Verified locally:
- go build -ldflags "-X main.version=1.2.3 -X main.commit=deadbeef ..."
→ "duckgres version 1.2.3 (commit: deadbeef, built: ...)"
- plain go build
→ "duckgres version dev (commit: 815063d-dirty, built: ...)"
And the log line appears as the first INFO line under --mode
duckdb-service and --mode control-plane.1 parent 815063d commit e97da8a
2 files changed
Lines changed: 68 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
| 363 | + | |
362 | 364 | | |
363 | 365 | | |
364 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
5 | 16 | | |
6 | 17 | | |
7 | 18 | | |
8 | 19 | | |
9 | 20 | | |
10 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
11 | 61 | | |
| 62 | + | |
12 | 63 | | |
13 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments