From 97b95f16865fe9a563e14f10897c20dca5d9a908 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Thu, 5 Jan 2023 14:59:14 +0100 Subject: [PATCH] Add centos9 based job And make centos8 jobs non voting Change-Id: I0002a53f6e2c3582b6de33d8c3e71101ff474196 --- .zuul.yaml | 38 ++++++++- playbooks/integration/centos9-image.yaml | 83 +++++++++++++++++++ .../integration/centos9-integration.yaml | 37 +++++++++ playbooks/integration/exercise.yaml | 2 +- 4 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 playbooks/integration/centos9-image.yaml create mode 100644 playbooks/integration/centos9-integration.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 3887972..db25710 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -119,6 +119,34 @@ metalsmith_root_size: 9 metalsmith_python: python3 +- job: + name: metalsmith-integration-glance-centos9-uefi + nodeset: openstack-single-node-jammy + description: | + Integration job using Glance as image source and Centos Stream 9 with + local boot and UEFI. Images are built with diskimage-builder. + parent: metalsmith-integration-base + timeout: 8500 + run: playbooks/integration/centos9-integration.yaml + vars: + devstack_localrc: + # NOTE(dtantsur): we need to use streaming, otherwise the image won't + # fit in RAM. + IRONIC_AGENT_IMAGE_DOWNLOAD_SOURCE: http + IRONIC_VM_SPECS_RAM: 3072 + devstack_services: + # Since we're using streaming, try non-swift backends. + s-account: false + s-container: false + s-object: false + s-proxy: false + configure_instance_user: metalsmith + metalsmith_precreate_port: false + metalsmith_partition_image: test-centos-partition + metalsmith_whole_disk_image: test-centos-wholedisk + metalsmith_swap_size: 1024 + metalsmith_traits: [CUSTOM_GOLD] + - job: name: metalsmith-integration-glance-centos8-uefi description: | @@ -173,13 +201,15 @@ - release-notes-jobs-python3 check: jobs: - - metalsmith-integration-glance-centos8-uefi - - metalsmith-integration-glance-centos8-legacy + - metalsmith-integration-glance-centos9-uefi + - metalsmith-integration-glance-centos8-uefi: + voting: false + - metalsmith-integration-glance-centos8-legacy: + voting: false - metalsmith-integration-http-cirros - openstack-tox-linters gate: jobs: - - metalsmith-integration-glance-centos8-uefi - - metalsmith-integration-glance-centos8-legacy + - metalsmith-integration-glance-centos9-uefi - metalsmith-integration-http-cirros - openstack-tox-linters diff --git a/playbooks/integration/centos9-image.yaml b/playbooks/integration/centos9-image.yaml new file mode 100644 index 0000000..49d63d7 --- /dev/null +++ b/playbooks/integration/centos9-image.yaml @@ -0,0 +1,83 @@ +--- +- name: "Set centos image facts" + set_fact: + centos_image_file: ~/centos9-wholedisk.qcow2 + centos_initramfs_file: ~/centos9-partition.initrd + centos_kernel_file: ~/centos9-partition.vmlinuz + centos_partition_file: ~/centos9-partition.qcow2 + +- name: Install kpartx + package: + name: kpartx + state: present + become: true + +- name: Install DIB + pip: + name: diskimage-builder + become: true + vars: + ansible_python_interpreter: /usr/bin/{{ metalsmith_python | default('python') }} + +- name: Make kernel files readable (workaround for Ubuntu) + shell: chmod 0644 /boot/vmlinuz-* + become: true + +- name: Detect the right block device element + set_fact: + centos_block_device: block-device-efi + when: metalsmith_boot_mode | default('uefi') != 'bios' + +- name: Build a centos9 wholedisk image + command: > + disk-image-create centos grub2 vm {{ centos_block_device | default('') }} + -o centos9-wholedisk + environment: + DIB_RELEASE: 9-stream + +- name: Build a centos9 partition image + command: disk-image-create centos grub2 baremetal -o centos9-partition + environment: + DIB_RELEASE: 9-stream + +- name: Upload the CentOS whole-disk image + command: > + openstack image create --disk-format qcow2 + --public --file {{ centos_image_file }} + {{ centos_glance_whole_disk_image }} + environment: + OS_CLOUD: devstack-admin + when: centos_glance_whole_disk_image is defined + +- name: Upload the CentOS kernel image + command: > + openstack image create --disk-format aki --container-format aki \ + --public --file {{ centos_kernel_file }} -f value -c id + {{ centos_glance_kernel_image }} + register: centos_kernel_id + failed_when: centos_kernel_id.stdout == "" + environment: + OS_CLOUD: devstack-admin + when: centos_glance_kernel_image is defined + +- name: Upload the CentOS initramfs image + command: > + openstack image create --disk-format ari --container-format ari \ + --public --file {{ centos_initramfs_file }} -f value -c id + {{ centos_glance_initramds_image }} + register: centos_initramfs_id + failed_when: centos_initramfs_id.stdout == "" + environment: + OS_CLOUD: devstack-admin + when: centos_glance_initramds_image is defined + +- name: Upload the CentOS partition image + command: > + openstack image create --disk-format qcow2 + --public --file {{ centos_partition_file }} + --property kernel_id={{ centos_kernel_id.stdout }} + --property ramdisk_id={{ centos_initramfs_id.stdout }} + {{ centos_glance_root_image }} + environment: + OS_CLOUD: devstack-admin + when: centos_glance_root_image is defined diff --git a/playbooks/integration/centos9-integration.yaml b/playbooks/integration/centos9-integration.yaml new file mode 100644 index 0000000..b2886a6 --- /dev/null +++ b/playbooks/integration/centos9-integration.yaml @@ -0,0 +1,37 @@ +--- +- name: Perform initial setup + import_playbook: initial-setup.yaml + +- hosts: all + environment: + OS_CLOUD: devstack-admin + + tasks: + - include_tasks: ssh-key.yaml + + - include_tasks: centos9-image.yaml + when: + - metalsmith_whole_disk_image is defined + - metalsmith_partition_image is defined + + - include_tasks: cirros-image.yaml + when: + - metalsmith_whole_disk_image is undefined + - metalsmith_partition_image is undefined + + - name: Test a whole-disk image + include_tasks: exercise.yaml + vars: + metalsmith_image: "{{ metalsmith_whole_disk_image }}" + metalsmith_image_checksum: "{{ metalsmith_whole_disk_checksum | default('') }}" + metalsmith_root_size: + # NOTE(dtantsur): cannot specify swap with whole disk images + metalsmith_swap_size: + + - name: Test a partition image + include_tasks: exercise.yaml + vars: + metalsmith_image: "{{ metalsmith_partition_image }}" + metalsmith_image_checksum: "{{ metalsmith_partition_checksum | default('') }}" + metalsmith_image_kernel: "{{ metalsmith_partition_kernel_image | default('') }}" + metalsmith_image_ramdisk: "{{ metalsmith_partition_ramdisk_image | default('') }}" diff --git a/playbooks/integration/exercise.yaml b/playbooks/integration/exercise.yaml index 4343a2b..ade136b 100644 --- a/playbooks/integration/exercise.yaml +++ b/playbooks/integration/exercise.yaml @@ -73,7 +73,7 @@ - name: SSH into the instance command: > - ssh -v -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 + ssh -vvv -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 {{ configure_instance_user | default('cirros') }}@{{ instance_ip }} "cat /etc/hostname" register: ssh_result