balena-os / meta-balena

A collection of Yocto layers used to build balenaOS images
https://www.balena.io/os
968 stars 115 forks source link

Old supervisor images are not removed #2219

Open klutchell opened 3 years ago

klutchell commented 3 years ago

Private discussion link: https://www.flowdock.com/app/rulemotion/r-supervisor/threads/mg4T0O0VJ3w1q1VCPG_YzTCisCN

The supervisor was supposed to clean the old images, but this code won't work with the new way to tag the supervisor images.

https://github.com/balena-os/balena-supervisor/blob/master/src/compose/images.ts#L397-L406

Since image tags have changed, then the supervisor has no way to identify old supervisor images.

Confirmed this by doing a supervisor update using the update-balena-supervisor script.

Before

root@cceab6e:~# balena images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED             SIZE
registry2.balena-cloud.com/v2/c4278bb92bdbd1d514b819146a385c59   <none>              291d6f0839e1        7 days ago          214MB
registry2.balena-cloud.com/v2/7b442250226c49e28e2c9f1237b2e8a1   latest              ac4cb891dc5b        5 weeks ago         62.8MB
root@cceab6e:~# balena ps
CONTAINER ID        IMAGE                                                                   COMMAND                  CREATED             STATUS                  PORTS               NAMES
5b3f8aada375        291d6f0839e1                                                            "/usr/bin/entry.sh n…"   18 hours ago        Up 18 hours                                 hello_3698079_1825241
5117e8fb66b4        registry2.balena-cloud.com/v2/7b442250226c49e28e2c9f1237b2e8a1:latest   "/usr/src/app/entry.…"   18 hours ago        Up 18 hours (healthy)                       balena_supervisor

After

root@cceab6e:~# balena ps
CONTAINER ID        IMAGE                                                                   COMMAND                  CREATED              STATUS                                 PORTS               NAMES
a3f494766de6        registry2.balena-cloud.com/v2/2f787b4a0f149d9f05ebb9f202f4c7ff:latest   "/usr/src/app/entry.…"   About a minute ago   Up About a minute (health: starting)                       balena_supervisor
5b3f8aada375        291d6f0839e1                                                            "/usr/bin/entry.sh n…"   18 hours ago         Up 18 hours                                                hello_3698079_1825241
root@cceab6e:~# balena images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED             SIZE
registry2.balena-cloud.com/v2/c4278bb92bdbd1d514b819146a385c59   <none>              291d6f0839e1        7 days ago          214MB
registry2.balena-cloud.com/v2/2f787b4a0f149d9f05ebb9f202f4c7ff   latest              29afe3a0cd02        2 weeks ago         62.9MB
registry2.balena-cloud.com/v2/7b442250226c49e28e2c9f1237b2e8a1   latest              ac4cb891dc5b        5 weeks ago         62.8MB
balena-healthcheck-image

The old supervisor image is still there, but since it has a weird tag it doesn't get deleted

jellyfish-bot commented 3 years ago

[pipex] This issue has attached support thread https://jel.ly.fish/25d64ef6-eb80-4d43-a40e-ed53df6406e8