fix: address rotation-revocation verify findings

Close handshakes and logins that started before a revocation or a
password change, converge after a failure in any phase, survive a closed
terminal, lock parallel commands and make the drill detect a dead load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 10:11:17 +03:00
co-authored by Claude Opus 5.5
parent f702a702d5
commit 6b637109de
41 changed files with 4092 additions and 291 deletions
+9 -11
View File
@@ -315,25 +315,23 @@ image=$(docker inspect -f '{{.Config.Image}}' "$(printf '%s\n' "$old" | head -n
# работающих, иначе замена молча выкатила бы другой код. Сначала манифест
# платформы против метки compose (docker.md); другой манифест — ещё не другой
# код: сборка другим проектом compose (make failure_checks) меняет только его
# метки в образе, поэтому тогда сравниваются файлы (пути, размеры, время)
# метки в образе, поэтому тогда файлы и Config сравнивает same_image.py
if [ "$build" = 0 ]; then
platform=$(docker version -f '{{.Server.Os}}/{{.Server.Arch}}')
tag_image=$(docker image inspect --platform "$platform" -f '{{.Id}}' "$image" 2>/dev/null) ||
fail 2 "no image $image for $platform"
files='find /app /usr/local -type f ! -path /app/config.toml -printf "%p %s %T@\n" | sort | sha256sum'
tag_files=""
rebuilt=""
for id in $old; do
running=$(docker inspect -f '{{index .Config.Labels "com.docker.compose.image"}}' "$id")
if [ "$running" = "$tag_image" ]; then
continue
fi
if [ -z "$tag_files" ]; then
tag_files=$(docker run --rm --network none --no-healthcheck --entrypoint sh "$image" -c "$files")
fi
if [ "$(docker exec "$id" sh -c "$files")" != "$tag_files" ]; then
fail 2 "replica $(short "$id") runs another build of $image: run make run_docker or make rolling_update first"
if [ "$running" != "$tag_image" ]; then
rebuilt="$rebuilt $id"
fi
done
if [ -n "$rebuilt" ]; then
# shellcheck disable=SC2086
reason=$("${PYTHON:-python3}" infra/rotation/same_image.py "$image" $rebuilt) ||
fail 2 "replicas run another build of $image ($reason): run make run_docker or make rolling_update first"
fi
fi
if [ "$check" = 1 ]; then
log "preconditions hold: $replicas replicas UP, nothing changed"