scionproto / scion

SCION Internet Architecture
https://www.scion-architecture.net/
Apache License 2.0
370 stars 156 forks source link

build: replace rules_docker with rules_oci #4487

Closed matzf closed 3 months ago

matzf commented 3 months ago

rules_docker is no longer maintained and causes issues with particular versions of docker (see e.g. https://github.com/scionproto/scion/issues/4480). Replace our use of rules_docker by https://github.com/bazel-contrib/rules_oci.

Due to differences in the rules, the build targets in //docker have slightly changed behaviour:

Introduce consistent naming and tagging of all produced docker images. All images are now tagged scion/<component>:latest. For router and gateway, the names were simplified by dropping the posix- prefix. For internal images used for testing we use nested names e.g. scion/tools/udpproxy or scion/acceptance/topo_reload_cs. Furthermore, all images are annotated with a docker label org.scion (no value). This allows cleaning up with a relatively simple match, as is now done in make clean. Additionally, the label org.scion.version will be set when building with --stamp. The motivation to be able to clean up is to have a simple way to ensure that tests actually pick up the intended images; I managed to thoroughly confuse myself by building new images with a misspelled name, causing old images to be picked up unnoticedly. I looked for different options to make this even stricter, but alternatives seemed either heavy handed (start a separate docker daemon, or temporarily rename all existing images), or toothless (e.g. use a randomized tag :test-xxx for all images, which can be bypassed by tests too easily).

More details:


Recommendation: remove any old scion-y images.

# enable commented section after double checking that these images are safe to remove
docker image ls --format '{{.ID}}\t{{.Repository}}:{{.Tag}}' | grep -E 'scion|dispatcher|daemon|control|tester|udpproxy|posix.router|posix.gateway|bazel\/' # | cut -f 1 | xargs docker image rm

Closes #4481

matzf commented 3 months ago

This change is Reviewable