With the introduction of Grace-Hopper nodes, we have now aarch64
and x86_64
machines. This implies that the container images should be built for the correct architecture. This can be achieved by the following example
include: - remote: 'https://gitlab.com/cscs-ci/recipes/-/raw/master/templates/v2/.ci-ext.yml' stages: - build - make_multiarch - run .build: stage: build variables: DOCKERFILE: path/to/my_dockerfile PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/${ARCH}/my_image_name:${CI_COMMIT_SHORT_SHA} build aarch64: extends: [.container-builder-cscs-gh200, .build] build x86_64: extends: [.container-builder-cscs-zen2, .build] make multiarch: extends: .make-multiarch-image stage: make_multiarch variables: PERSIST_IMAGE_NAME: $CSCS_REGISTRY_PATH/my_multiarch_image:${CI_COMMIT_SHORT_SHA} PERSIST_IMAGE_NAME_AARCH64: $CSCS_REGISTRY_PATH/aarch64/my_image_name:${CI_COMMIT_SHORT_SHA} PERSIST_IMAGE_NAME_X86_64: $CSCS_REGISTRY_PATH/x86_64/my_image_name:${CI_COMMIT_SHORT_SHA} .run: stage: run image: $CSCS_REGISTRY_PATH/my_multiarch_image:${CI_COMMIT_SHORT_SHA} script: - uname -a run aarch64: extends: [.container-runner-daint-gh200, .run] run x86_64: extends: [.container-runner-eiger-mc, .run]
We first create two container images which have different names. Then we combine these two names to a single name, with both architectures. Finally in the run step we use the multi-architecture image, where the container runtime will pull the correct architecture.
It is not necessary to combine the container images to a multi-architecture image, i.e. a CI setup which consistently uses the correct architecture specific paths can work. A multi-architecture image is convenient when you plan to distribute it to other users.