Skip to content

Commit 555c296

Browse files
committed
Add ability to choose image build platform
1 parent e86925d commit 555c296

File tree

7 files changed

+26
-9
lines changed

7 files changed

+26
-9
lines changed

.github/workflows/overcloud-host-image-build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ on:
1111
description: Build Ubuntu 22.04 Jammy
1212
type: boolean
1313
default: true
14+
cpu-platform-architecture:
15+
description: Select the image's build architecture
16+
type: choice
17+
default: x86
18+
options:
19+
- x86
20+
- aarch64
1421
secrets:
1522
KAYOBE_VAULT_PASSWORD:
1623
required: true
@@ -25,6 +32,7 @@ env:
2532
ANSIBLE_FORCE_COLOR: True
2633
KAYOBE_ENVIRONMENT: ci-builder
2734
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
35+
overcloud_dib_architechture: ${{ inputs.cpu-platform-architecture == 'x86' && 'amd64' || 'arm64' }}
2836
jobs:
2937
overcloud-host-image-build:
3038
name: Build overcloud host images
@@ -242,7 +250,7 @@ jobs:
242250
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
243251
-e artifact_path=/opt/kayobe/images/overcloud-rocky-9 \
244252
-e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
245-
-e artifact_type="kayobe-images" \
253+
-e artifact_type="kayobe-images/{{ inputs.cpu-platform-architecture }}" \
246254
-e file_regex="*.qcow2" \
247255
-e os_distribution="rocky" \
248256
-e os_release="9"
@@ -258,6 +266,7 @@ jobs:
258266
src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \
259267
-e local_image_path="/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2" \
260268
-e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }}
269+
-e cpu-platform=${{ env.overcloud_dib_architechture }}
261270
env:
262271
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
263272
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
@@ -296,7 +305,7 @@ jobs:
296305
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
297306
-e artifact_path=/opt/kayobe/images/overcloud-ubuntu-jammy \
298307
-e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
299-
-e artifact_type="kayobe-images" \
308+
-e artifact_type="kayobe-images/{{ inputs.cpu-platform-architecture }}" \
300309
-e file_regex="*.qcow2" \
301310
-e os_distribution="ubuntu" \
302311
-e os_release="jammy"
@@ -312,6 +321,7 @@ jobs:
312321
src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \
313322
-e local_image_path="/opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.qcow2" \
314323
-e image_name=overcloud-ubuntu-jammy-${{ steps.host_image_tag.outputs.host_image_tag }}
324+
-e cpu-platform=${{ env.overcloud_dib_architechture }}
315325
env:
316326
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
317327
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}

etc/kayobe/ansible/openstack-host-image-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
hosts: seed
77
vars:
88
local_image_path: /opt/kayobe/images/overcloud-{{ os_distribution }}-{{ os_release }}/overcloud-{{ os_distribution }}-{{ os_release }}.qcow2
9-
image_name: overcloud-{{ os_distribution }}-{{ os_release }}
9+
image_name: overcloud-{{ os_distribution }}-{{ os_release }}-{{ cpu-platform }}
1010
tasks:
1111
- name: Upload image to Glance
1212
block:

etc/kayobe/environments/ci-builder/overcloud-dib.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ overcloud_dib_build_host_images: true
1818
# "packages": "{{ overcloud_dib_packages }}"}.
1919
overcloud_dib_host_images:
2020
- "{{ stackhpc_overcloud_dib_host_image }}"
21-
22-
overcloud_dib_architecture: "arm64"

etc/kayobe/kolla.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,11 @@ kolla_build_customizations: "{{ kolla_build_customizations_common | combine(koll
419419
# Dict mapping Kolla Dockerfile ARG names to their values.
420420
kolla_build_args: {}
421421

422+
###############################################################################
423+
# Kolla platform architecture configuration.
424+
425+
kolla_base_arch: "{{ 'aarch64' if stackhpc_cpu_arch == 'arm64' else 'x86' }}"
426+
422427
###############################################################################
423428
# Kolla-ansible inventory configuration.
424429

etc/kayobe/overcloud-dib.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ overcloud_dib_host_packages_extra:
6767
overcloud_dib_git_elements_extra:
6868
- repo: "https://github.com/stackhpc/stackhpc-image-elements"
6969
local: "{{ source_checkout_path }}/stackhpc-image-elements"
70-
version: "aarch64-image-build"
70+
version: "v1.6.3"
7171
elements_path: "elements"
7272

73-
74-
overcloud_dib_architecture: "arm64"
73+
# Selects the architecture of the overcloud host image being built.
74+
overcloud_dib_architechture: "{{ 'amd64' if stackhpc_cpu_arch == 'x86' else 'arm64' }}"
7575

7676
# List of git repositories containing Diskimage Builder (DIB) elements. See
7777
# stackhpc.openstack.os_images role for usage. Default is a combination of

etc/kayobe/stackhpc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ stackhpc_include_os_minor_version_in_repo_url: false
2727

2828
stackhpc_rocky_9_url_version: "{{ '9.' + stackhpc_pulp_repo_rocky_9_minor_version | string if stackhpc_include_os_minor_version_in_repo_url | bool else '9' }}"
2929

30+
# Pick build architecture for kolla and disk image builder
31+
# Choose between x86 or arm64
32+
stackhpc_cpu_arch: 'x86'
33+
3034
###############################################################################
3135
# Debs
3236
# Ubuntu jammy

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
kayobe@git+https://github.com/stackhpc/kayobe@aarch64-image-build
1+
kayobe@git+https://github.com/stackhpc/kayobe@stackhpc/2024.1
22
ansible-modules-hashivault>=5.2.1
33
jmespath

0 commit comments

Comments
 (0)