Stamp the git tag or short commit into the binary (closes #4)
A plain `docker build .` now stamps bsdaily's version: the VERSION build argument when one is given, otherwise `git describe --tags --always` on the .git in the build context, as the canonical Dockerfile does. The build fails if .git is there and the version still comes out empty, dev or unknown. A host `make` build stamps the same `git describe`, or dev. bsdaily logs the version on the first line of every run and prints it with --version; a build that stamps nothing, or an empty value, reports dev. Judgement call: the build line also takes the canonical -trimpath and -s -w. One //nolint (gochecknoglobals): -X can only set a package-level variable. Model: opus-5-5
This commit is contained in:
@@ -189,6 +189,7 @@ A single run proceeds as follows:
|
||||
bsdaily # extract the snapshot date minus one day
|
||||
bsdaily --date 2026-06-27 # extract a single specific day
|
||||
bsdaily --from 2026-06-01 --to 2026-06-27 # extract an inclusive range
|
||||
bsdaily --version # print the version and exit
|
||||
```
|
||||
|
||||
Flags:
|
||||
@@ -197,9 +198,20 @@ Flags:
|
||||
`--from`/`--to`.
|
||||
- `--from YYYY-MM-DD` — start of an inclusive range (requires `--to`).
|
||||
- `--to YYYY-MM-DD` — end of an inclusive range (requires `--from`).
|
||||
- `-v`, `--version` — print the version and exit.
|
||||
|
||||
With no flags, the tool extracts the day before the latest snapshot. All
|
||||
progress is logged as structured `slog` text to stderr.
|
||||
progress is logged as structured `slog` text to stderr; the first line of every
|
||||
run carries the version.
|
||||
|
||||
The version is the git tag or short commit the binary was built from, set at
|
||||
link time. `docker build .` takes it from the `VERSION` build argument when one
|
||||
is given, otherwise from `git describe --tags --always` on the `.git` in the
|
||||
build context, and fails if `.git` is there and the version still comes out
|
||||
empty, `dev` or `unknown`. `script/docker` and `script/cibuild` pass
|
||||
`git describe --tags --always --dirty` from the host as that argument. `make`
|
||||
runs the same `git describe` on the host. A build with no version to go on
|
||||
reports `dev`.
|
||||
|
||||
## Merging dumps back into a database
|
||||
|
||||
|
||||
Reference in New Issue
Block a user