Docker builds report unknown version, and profiling output is truncated on error #75
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two independent defects in build metadata and developer tooling.
1. Docker images cannot report their version or commit
.dockerignoreexcludes.git, but the Dockerfile build stage embedsthe commit with:
Inside the container there is no
.git, so this always evaluates tounknown. Every Docker-built image reportscommit: unknown, build date: unknown. Separately,ARG VERSION=devis never passed byscript/docker, so the version isdevtoo.The result: a container image that cannot identify which source it was
built from. For a backup tool, being unable to answer "which build
produced this archive?" is a real operational problem, not cosmetic.
2.
os.Exit(1)discards pprof outputcli.Entry()(internal/cli/entry.go:34-36) callsos.Exit(1)on anycommand error. That skips
main'sdefer pprof.StopCPUProfile()(
cmd/vaultik/main.go:26) and the entire deferred heap-profile writer(
main.go:31-44).So profiling a failing command — often exactly the command you want to
profile — silently yields a truncated or empty profile, with no warning
that the data is unusable.
Definition of done
ARGs fromscript/docker(computed on the host, where.gitexists), rather than being computed inside the container. Do not solve
this by un-ignoring
.git— that bloats the build context and buststhe layer cache on every commit.
docker run … vaultik versionprints a real version, commit sha, andbuild date matching the host checkout it was built from.
-dirtysuffix) so an image built from uncommitted changes cannotmasquerade as a clean build.
restructure
Entry/mainso cleanup runs before exit — haveEntryreturn a status code that
mainturns intoos.Exitafter itsdefers, rather than exiting from within. Do not paper over it by
duplicating the profile-flush logic at each exit site.
command with
VAULTIK_CPUPROFILEset and confirm the resulting profileis readable and non-empty.
first, build on its mechanism rather than adding a second one.
make checkgreen.