fix: remove only the images the deploy replaced, never every unused one
CI / check (pull_request) Successful in 19s

The deploy ended with docker image prune -af: every image no container
used at that moment. On a host that runs other things too, that takes
their rollback images; the KB's copy of this line did exactly that on
compute-01 (NetOrk/kb-server#157).

deploy.sh now records the image IDs netOrk's own containers use before
the swap and, after the verification and the migration, hands them to
remote/remove_replaced_images.sh. It removes each by its tags, or by its
ID once a moving tag left it without one, and keeps any image a
container still uses: a redeploy of the same tag replaces nothing.
This commit is contained in:
Christian Manivong committed 2026-10-23 12:06:08 +02:00
1 parent e35d42a20b
commit 476afe3982
5 files changed
+254 -3

No files matched your search

+6 -1
View File
@@ -126,7 +126,12 @@ started earlier pulls whatever image the registry held before, which is stale.
10. Verifies that the containers run exactly the image that was pulled. If they don't, the
deploy fails.
11. Runs `alembic upgrade head` inside `netork-api`.
12. Prunes unused images.
12. Removes the images the swap replaced, and only those. Before the swap it records which
images netOrk's own containers use; afterwards `remote/remove_replaced_images.sh`
removes them unless a container still uses one, a redeploy of the same tag for
example. Other projects' images on the host stay. This used to be
`docker image prune -af`, which took every unused image, theirs included
(NetOrk/kb-server#157).
A failing step stops that server's deploy with a non-zero exit, and the other servers
carry on. The script exits non-zero if any server failed and names those servers.