Description
We have a suite of tests for our Docker image in the DockerTests
class, which can be run via:
./gradlew :qa:os:destructiveDistroTest.default-docker
This task is configured to depend on a Docker export task, which itself depends on a Docker build task. This works fine. However following #53936, now we can build Docker images for ARM, with:
./gradlew distribution:docker:buildAarch64DockerImage
but there is no support for running the packaging tests against the ARM image, because the dependency graph assumes the x86 build.
Now, the Docker packaging tests don't actually care what Docker machine's architecture is. We could make the tests depend on an "alias" task, which builds whichever is the correct Docker image for the current platform.
In so doing, we would also give ourselves a point to override this behaviour, and explicitly target a specific architecture. The use-case is where someone is developing the Docker images and has a Docker machine capable of running more x86 and ARM images (notably, Docker for Mac et al support this via QEMU and binfmt_misc
). In this case, it would be useful to be able to perform e.g.
./gradlew -Ddocker.arch=aarch64 :qa:os:destructiveDistroTest.default-docker
Orthogonal but related to this is that for multi-arch Docker builds, we will need to be able to build and push images with different tags, which are then brought together using docker manifest
. Right now, the ARM Docker build creates images with the same tags as the x86 images, which is pretty confusing when you're working on the images locally. We should consider including the architecture in the Docker tag, for both x86
and aarch64
. In this case it might be useful to use Docker's conventions, which are amd64
and arm64
.