Skip to content

Commit 8ecd7ef

Browse files
committed
Run multiarch/qemu-user-static image for cross-arch
This approach is taken in Kolla CI and Kayobe for building cross-arch OCI images, reuse it here.
1 parent 25d22ff commit 8ecd7ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

roles/os_images/tasks/prereqs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@
2929
state: directory
3030
mode: "0755"
3131
become: true
32+
33+
- name: Run multiarch/qemu-user-static image to support cross-arch build
34+
ansible.builtin.command:
35+
# We already have a precheck for presence of docker executable so use it here
36+
cmd: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
37+
# Using --reset means that we always change something
38+
changed_when: true
39+
become: true
40+
when: os_images_list |
41+
selectattr("architecture", "defined") |
42+
rejectattr("architecture", "equalto", ansible_facts.architecture) |
43+
length > 0

0 commit comments

Comments
 (0)