install: Only remove BlueOS containers and images - #4355
Conversation
Automated PR Review0. Summary
Scopes the 1. Correctness & Implementation Bugs
3. Security
6. Code Quality & Style
Generated by PR Review Bot. This is advisory, a human reviewer must still approve. |
joaomariolago
left a comment
There was a problem hiding this comment.
I would recommend to take a look at the AI review points [1.1 and 1.2], specifically the entry guard to the remove code that currently checks for any container.
| docker rm $(docker ps -a -q) | ||
| docker image prune -af | ||
| docker rm $(docker ps -a -q --filter name=blueos) | ||
| docker rmi $(docker images -q --filter reference='*blueos-core*') $(docker images -q --filter reference='*blueos-bootstrap*') |
There was a problem hiding this comment.
I think that we need to add a forced remove here to keep compatibility with the old code.
|
@joaomariolago check now |
3ddc8c0 to
83d430f
Compare
755c241 to
6ed51b1
Compare
NO_CLEAN wipe was stopping every container and pruning all unused images. Fix bluerobotics#2747 Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
6ed51b1 to
c812607
Compare
|
ping @joaomariolago |
| test $NO_CLEAN || ( | ||
| # Check if there is any docker installed | ||
| [[ $(docker ps -a -q) ]] && ( | ||
| blueos_containers=$(docker ps -a -q --filter name=blueos) |
There was a problem hiding this comment.
| blueos_containers=$(docker ps -a -q --filter name=blueos) | |
| blueos_containers=$(docker ps -a -q --filter name=blueos-core --filter name=blueos-bootstrap) |
Current code includes extensions with blueos on the name or registry like major_tom.
| # Check if there is any docker installed | ||
| [[ $(docker ps -a -q) ]] && ( | ||
| blueos_containers=$(docker ps -a -q --filter name=blueos) | ||
| blueos_images=$(docker images -q --filter reference='*/blueos-core*' --filter reference='blueos-core*' --filter reference='*/blueos-bootstrap*' --filter reference='blueos-bootstrap*') |
There was a problem hiding this comment.
| blueos_images=$(docker images -q --filter reference='*/blueos-core*' --filter reference='blueos-core*' --filter reference='*/blueos-bootstrap*' --filter reference='blueos-bootstrap*') | |
| blueos_images=$(docker images -q --filter reference='blueos-core*' --filter reference='*/blueos-core*' --filter reference='*/*/blueos-core*' --filter reference='blueos-bootstrap*' --filter reference='*/blueos-bootstrap*' --filter reference='*/*/blueos-bootstrap*') |
In case someone installed from a custom remote.
| docker rm $(docker ps -a -q) | ||
| docker image prune -af | ||
| [[ -n $blueos_containers ]] && docker rm $blueos_containers | ||
| [[ -n $blueos_images ]] && docker rmi -f $blueos_images |
There was a problem hiding this comment.
| [[ -n $blueos_images ]] && docker rmi -f $blueos_images | |
| [[ -n $blueos_images ]] && docker rmi -f $blueos_images | |
| # Remove only dangling layers | |
| docker image prune -f |
NO_CLEAN wipe was stopping every container and pruning all unused images.
Fix #2747