Ask the container what it is running

Preflight's first check ran `--version` on --binary. A container-only host
has no such file, so the check failed, and because it is first, nothing
downstream ever ran — including every container check that exists to
decide whether that container can be migrated at all. The container path
was unreachable on exactly the hosts it is for.

A host that happens to have a binary is the worse case, not the better
one: a stray /usr/local/bin/stalwart from an older install answers
confidently with a version nothing is running, and the whole migration
plan is derived from that number.

The source version now comes from running the image the container is on,
by ID rather than by the tag it was started from, using the same command
and the same fallback stage already uses for the target image — the two
have to agree about what a Stalwart image reports or the source and
target could be read by different rules. Verified against a real
stalwartlabs/stalwart image, not only the fake.

Deployment kind is detected once and shared, rather than asked again by
the check that reports it. Two answers for one run is not a thing this
should be able to produce.

The same reasoning retires preserve-binary on a container: there is
nothing on this host to move aside, and the equivalent is already
guaranteed, since cutover renames the old container and never prunes the
old image. Renaming a stray binary would have preserved something nothing
was running.
This commit is contained in:
2026-08-29 17:56:32 -07:00
parent 82ddb027e4
commit 56152ed7de
6 changed files with 150 additions and 4 deletions
+9
View File
@@ -436,6 +436,15 @@ func describeOverrides(f ContainerFacts) string {
return ", including what it overrides on its image: " + strings.Join(parts, ", ")
}
// containerNameOr is the container this tool would act on, defaulted the
// same way every other caller defaults it.
func containerNameOr(name string) string {
if name == "" {
return "stalwart"
}
return name
}
func shortID(id string) string {
id = strings.TrimPrefix(id, "sha256:")
if len(id) > 12 {