Testing an Intel and Arm multi-architecture Docker image on CircleCI
multi-architecture docker images dockerThis is the fourth article about my adventures trying to use my Apple M1 MacBook for development. In the previous article, I described how to configure a CircleCI-based CI/CD pipeline to build a multi-architecture image and push it to a remote repository. The image supports both Intel and ARM architectures. However, the pipeline only tests the image on Intel. In this article, I describe how to configure the pipeline to also test the Docker image on other architectures.
The other articles in this series are:
- Part 1 - My Apple M1 MacBook: lots of cores, memory and crashing containers
- Part 2 - Building multi-architecture Docker images for Intel and ARM
- Part 3 - Configuring a CircleCI-based pipeline to build multi-architecture Docker images
- Part 5 - Configuring CircleCI to publish a multi-architecture Docker image
- Part 6 - Developing the Eventuate Common library on an M1/Arm MacBook
- Part 7 - Configuring CircleCI to build, test and publish multi-architecture images for Eventuate Common
- Part 8 - Building a multi-architecture Docker image for Apache Kafka
- Part 9 - Publishing multi-architecture base images for services
- Part 10 - Publishing a multi-architecture Docker image for the Eventuate CDC service
- Part 11 - The Eventuate Tram Customers and Orders example now runs on Arm/M1 MacBook!!
Configuring the pipeline to test on Arm
By default, CircleCI jobs run on an Intel platform. However, CirclCI also supports the ARM platform. You can create an Arm-based job as follows:
test-arm64:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
The resource_class
attribute specifies the ARM resource.
We can configure the pipeline to execute the test-arm64
job after the build
job with the following workflow configuration:
workflows:
version: 2.1
build-test-and-deploy:
jobs:
- build
- test-arm64:
requires:
- build
Extracting a test script from build-and-test-multi-arch-circleci.sh
The testing logic needed by the test-arm64
job is currently embedded within build-and-test-multi-arch-circleci.sh
.
The solution is to split that script into two: build-and-push-multi-arch-circleci.sh
and test-multi-arch-circleci.sh
.
The build
job runs both of these scripts.
The test-arm64
job runs just the test script:
test-arm64:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
working_directory: ~/plantuml
steps:
- checkout
- run: ./test-multi-arch-circleci.sh
After making these changes the CircleCI pipeline performs the following steps:
- Builds, pushes and tests (on Intel) the multi-architecture image
- Builds, tests and pushes the original Docker image
- Tests the multi-architecture image on Arm
We are now one step closer to a complete pipeline that builds, tests and publishes a multi-architecture Docker image. In the next article, I reconfigure the pipeline to eliminate the original single architecture image and publish the tested multi-architecture image to Docker Hub.
Viewing the changes
To see the changes I made to the project, take a look at this Github commit.