Merge "CI: completely switch to CentOS images for testing"
This commit is contained in:
commit
714e27aa11
@ -13,7 +13,7 @@
|
|||||||
- ^test-requirements.txt$
|
- ^test-requirements.txt$
|
||||||
- ^tools/.*$
|
- ^tools/.*$
|
||||||
- ^tox.ini$
|
- ^tox.ini$
|
||||||
timeout: 3600
|
timeout: 5400
|
||||||
required-projects:
|
required-projects:
|
||||||
- openstack/keystone
|
- openstack/keystone
|
||||||
- openstack/neutron
|
- openstack/neutron
|
||||||
|
78
playbooks/integration/centos-image.yaml
Normal file
78
playbooks/integration/centos-image.yaml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
- name: Install guestfish
|
||||||
|
package:
|
||||||
|
name: libguestfs-tools
|
||||||
|
state: present
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Make kernel files readable (workaround for Ubuntu)
|
||||||
|
shell: chmod 0644 /boot/vmlinuz-*
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Set CentOS image name
|
||||||
|
set_fact:
|
||||||
|
centos_image_name: CentOS-7-x86_64-GenericCloud
|
||||||
|
|
||||||
|
- name: Set CentOS image facts
|
||||||
|
set_fact:
|
||||||
|
centos_image_url: https://cloud.centos.org/centos/7/images/{{ centos_image_name }}.qcow2.xz
|
||||||
|
centos_image_file: ~/{{ centos_image_name }}.qcow2
|
||||||
|
centos_kernel_file: ~/{{ centos_image_name }}.kernel
|
||||||
|
centos_initramfs_file: ~/{{ centos_image_name }}.initramfs
|
||||||
|
centos_partition_file: ~/{{ centos_image_name }}-root.qcow2
|
||||||
|
|
||||||
|
- name: Download the CentOS image
|
||||||
|
get_url:
|
||||||
|
url: "{{ centos_image_url }}"
|
||||||
|
dest: "{{ centos_image_file }}.xz"
|
||||||
|
register: centos_image_result
|
||||||
|
until: centos_image_result | succeeded
|
||||||
|
retries: 3
|
||||||
|
delay: 10
|
||||||
|
|
||||||
|
- name: Unpack the CentOS image
|
||||||
|
command: xz -d {{ centos_image_file }}.xz
|
||||||
|
|
||||||
|
- name: Print filesystems from the image
|
||||||
|
command: virt-filesystems -a {{ centos_image_file }} -l --extra --block-devices
|
||||||
|
|
||||||
|
- name: Create a temporary directory for extraction
|
||||||
|
tempfile:
|
||||||
|
state: directory
|
||||||
|
suffix: boot
|
||||||
|
register: temp_dir
|
||||||
|
|
||||||
|
- name: Extract kernel/ramdisk from the image
|
||||||
|
command: >
|
||||||
|
virt-get-kernel -a {{ centos_image_file }}
|
||||||
|
-o {{ temp_dir.path }} --unversioned-names
|
||||||
|
environment:
|
||||||
|
LIBGUESTFS_DEBUG: 1
|
||||||
|
|
||||||
|
- name: Copy the kernel and ramdisk to the target directory
|
||||||
|
copy:
|
||||||
|
src: "{{ temp_dir.path }}/{{ item.src }}"
|
||||||
|
dest: "{{ item.dest }}"
|
||||||
|
remote_src: yes
|
||||||
|
with_items:
|
||||||
|
- src: vmlinuz
|
||||||
|
dest: "{{ centos_kernel_file }}"
|
||||||
|
- src: initramfs
|
||||||
|
dest: "{{ centos_initramfs_file }}"
|
||||||
|
|
||||||
|
- name: Extract the root file system
|
||||||
|
command: virt-tar-out -a {{ centos_image_file }} / {{ temp_dir.path }}/root.tar
|
||||||
|
environment:
|
||||||
|
LIBGUESTFS_DEBUG: 1
|
||||||
|
|
||||||
|
- name: Pack the root file system into a partition image
|
||||||
|
command: virt-make-fs {{ temp_dir.path }}/root.tar {{ centos_partition_file }}
|
||||||
|
environment:
|
||||||
|
LIBGUESTFS_DEBUG: 1
|
||||||
|
|
||||||
|
- name: Print filesystems from the image
|
||||||
|
command: virt-filesystems -a {{ centos_partition_file }} -l --extra --block-devices
|
||||||
|
|
||||||
|
- name: Remove the temporary directory
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: "{{ temp_dir.path }}"
|
@ -2,65 +2,55 @@
|
|||||||
environment:
|
environment:
|
||||||
OS_CLOUD: devstack-admin
|
OS_CLOUD: devstack-admin
|
||||||
|
|
||||||
vars:
|
|
||||||
centos_file: CentOS-7-x86_64-GenericCloud.qcow2
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- include: ssh-key.yaml
|
- include: ssh-key.yaml
|
||||||
|
|
||||||
- name: Find Cirros UEC image
|
- include: centos-image.yaml
|
||||||
shell: |
|
|
||||||
openstack image list -f value -c ID -c Name \
|
|
||||||
| awk '/cirros.*uec/ { print $1; exit 0; }'
|
|
||||||
register: cirros_uec_image_result
|
|
||||||
|
|
||||||
- name: Find Cirros disk image
|
- name: Upload the CentOS whole-disk image
|
||||||
shell: |
|
|
||||||
openstack image list -f value -c ID -c Name \
|
|
||||||
| awk '/cirros.*disk/ { print $1; exit 0; }'
|
|
||||||
register: cirros_disk_image_result
|
|
||||||
|
|
||||||
- name: Check that Cirros UEC image was found
|
|
||||||
fail:
|
|
||||||
msg: No Cirros UEC image found
|
|
||||||
when: cirros_uec_image_result.stdout == ""
|
|
||||||
|
|
||||||
- name: Check that Cirros disk image was found
|
|
||||||
fail:
|
|
||||||
msg: No Cirros disk image found
|
|
||||||
when: cirros_disk_image_result.stdout == ""
|
|
||||||
|
|
||||||
- name: Download the CentOS image
|
|
||||||
get_url:
|
|
||||||
url: https://cloud.centos.org/centos/7/images/{{ centos_file }}.xz
|
|
||||||
dest: ~/{{ centos_file }}.xz
|
|
||||||
register: centos_image_result
|
|
||||||
until: centos_image_result | succeeded
|
|
||||||
retries: 3
|
|
||||||
delay: 10
|
|
||||||
|
|
||||||
- name: Unpack the CentOS image
|
|
||||||
command: xz -d {{ centos_file }}.xz
|
|
||||||
|
|
||||||
- name: Upload the CentOS image
|
|
||||||
command: >
|
command: >
|
||||||
openstack image create --disk-format qcow2
|
openstack image create --disk-format qcow2
|
||||||
--file {{ centos_file }} test-centos-image
|
--public --file {{ centos_image_file }} test-centos-wholedisk
|
||||||
|
|
||||||
- include: exercise.yaml
|
- 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 test-centos-kernel
|
||||||
|
register: centos_kernel_id
|
||||||
|
failed_when: centos_kernel_id.stdout == ""
|
||||||
|
|
||||||
|
- 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 test-centos-initramfs
|
||||||
|
register: centos_initramfs_id
|
||||||
|
failed_when: centos_initramfs_id.stdout == ""
|
||||||
|
|
||||||
|
- 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 }}
|
||||||
|
test-centos-partition
|
||||||
|
|
||||||
|
- name: Test partition image with netboot
|
||||||
|
include: exercise.yaml
|
||||||
vars:
|
vars:
|
||||||
image: "{{ cirros_uec_image_result.stdout }}"
|
image: test-centos-partition
|
||||||
precreate_port: false
|
precreate_port: false
|
||||||
extra_args: --netboot
|
extra_args: --netboot
|
||||||
|
|
||||||
- include: exercise.yaml
|
- name: Test whole-disk image with local boot
|
||||||
|
include: exercise.yaml
|
||||||
vars:
|
vars:
|
||||||
image: "{{ cirros_disk_image_result.stdout }}"
|
image: test-centos-wholedisk
|
||||||
precreate_port: true
|
|
||||||
extra_args: --netboot
|
|
||||||
|
|
||||||
- include: exercise.yaml
|
|
||||||
vars:
|
|
||||||
image: test-centos-image
|
|
||||||
precreate_port: false
|
precreate_port: false
|
||||||
extra_args: ''
|
extra_args: ''
|
||||||
|
|
||||||
|
- name: Test partition image with local boot and port
|
||||||
|
include: exercise.yaml
|
||||||
|
vars:
|
||||||
|
image: test-centos-partition
|
||||||
|
precreate_port: true
|
||||||
|
extra_args: ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user