Merge "Rework jobs so failed devstack does not retry the job"
This commit is contained in:
commit
88a6a5b28b
@ -3,7 +3,6 @@
|
|||||||
description: |
|
description: |
|
||||||
Base job for devstack-based metalsmith jobs.
|
Base job for devstack-based metalsmith jobs.
|
||||||
parent: devstack-minimal
|
parent: devstack-minimal
|
||||||
pre-run: playbooks/integration/pre.yaml
|
|
||||||
post-run: playbooks/integration/post.yaml
|
post-run: playbooks/integration/post.yaml
|
||||||
run: playbooks/integration/run.yaml
|
run: playbooks/integration/run.yaml
|
||||||
irrelevant-files:
|
irrelevant-files:
|
||||||
@ -120,7 +119,6 @@
|
|||||||
Integration job using Glance as image source and CentOS7 with local boot.
|
Integration job using Glance as image source and CentOS7 with local boot.
|
||||||
parent: metalsmith-integration-base
|
parent: metalsmith-integration-base
|
||||||
timeout: 7200
|
timeout: 7200
|
||||||
pre-run: playbooks/integration/centos-image.yaml
|
|
||||||
vars:
|
vars:
|
||||||
devstack_localrc:
|
devstack_localrc:
|
||||||
# NOTE(dtantsur): we need to use streaming, otherwise the image won't
|
# NOTE(dtantsur): we need to use streaming, otherwise the image won't
|
||||||
|
@ -1,145 +1,149 @@
|
|||||||
---
|
---
|
||||||
- hosts: all
|
- name: Set facts for centos image builds
|
||||||
environment:
|
set_fact:
|
||||||
OS_CLOUD: devstack-admin
|
|
||||||
|
|
||||||
vars:
|
|
||||||
centos_image_file: ~/centos-download.qcow2
|
centos_image_file: ~/centos-download.qcow2
|
||||||
centos_initramfs_file: ~/centos.initramfs
|
centos_initramfs_file: ~/centos.initramfs
|
||||||
centos_kernel_file: ~/centos.kernel
|
centos_kernel_file: ~/centos.kernel
|
||||||
centos_partition_file: ~/centos-root.qcow2
|
centos_partition_file: ~/centos-root.qcow2
|
||||||
centos_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz
|
centos_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz
|
||||||
|
|
||||||
tasks:
|
- name: Install guestfish
|
||||||
- name: Install guestfish
|
package:
|
||||||
package:
|
name: libguestfs-tools
|
||||||
name: libguestfs-tools
|
state: present
|
||||||
state: present
|
become: true
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Make kernel files readable (workaround for Ubuntu)
|
- name: Make kernel files readable (workaround for Ubuntu)
|
||||||
shell: chmod 0644 /boot/vmlinuz-*
|
shell: chmod 0644 /boot/vmlinuz-*
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Download the CentOS image
|
- name: Download the CentOS image
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ centos_image_url }}"
|
url: "{{ centos_image_url }}"
|
||||||
dest: "{{ centos_image_file }}.xz"
|
dest: "{{ centos_image_file }}.xz"
|
||||||
register: centos_image_result
|
register: centos_image_result
|
||||||
until: centos_image_result is succeeded
|
until: centos_image_result is succeeded
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 10
|
delay: 10
|
||||||
|
|
||||||
- name: Unpack the CentOS image
|
- name: Unpack the CentOS image
|
||||||
command: xz -d {{ centos_image_file }}.xz
|
command: xz -d {{ centos_image_file }}.xz
|
||||||
|
|
||||||
- name: Print filesystems from the image
|
- name: Print filesystems from the image
|
||||||
command: virt-filesystems -a {{ centos_image_file }} -l --extra --block-devices
|
command: virt-filesystems -a {{ centos_image_file }} -l --extra --block-devices
|
||||||
|
|
||||||
- name: Upload the CentOS whole-disk image
|
- name: Upload the CentOS whole-disk image
|
||||||
command: >
|
command: >
|
||||||
openstack image create --disk-format qcow2
|
openstack image create --disk-format qcow2
|
||||||
--public --file {{ centos_image_file }}
|
--public --file {{ centos_image_file }}
|
||||||
{{ centos_glance_whole_disk_image }}
|
{{ centos_glance_whole_disk_image }}
|
||||||
when: centos_glance_whole_disk_image is defined
|
environment:
|
||||||
|
OS_CLOUD: devstack-admin
|
||||||
|
when: centos_glance_whole_disk_image is defined
|
||||||
|
|
||||||
- name: Create a temporary directory for extraction
|
- name: Create a temporary directory for extraction
|
||||||
tempfile:
|
tempfile:
|
||||||
state: directory
|
state: directory
|
||||||
suffix: boot
|
suffix: boot
|
||||||
register: temp_dir
|
register: temp_dir
|
||||||
|
|
||||||
- name: Extract kernel/ramdisk from the image
|
- name: Extract kernel/ramdisk from the image
|
||||||
command: >
|
command: >
|
||||||
virt-get-kernel -a {{ centos_image_file }}
|
virt-get-kernel -a {{ centos_image_file }}
|
||||||
-o {{ temp_dir.path }} --unversioned-names
|
-o {{ temp_dir.path }} --unversioned-names
|
||||||
|
|
||||||
- name: Upload the CentOS kernel image
|
- name: Upload the CentOS kernel image
|
||||||
command: >
|
command: >
|
||||||
openstack image create --disk-format aki --container-format aki \
|
openstack image create --disk-format aki --container-format aki \
|
||||||
--public --file {{ temp_dir.path }}/vmlinuz -f value -c id
|
--public --file {{ temp_dir.path }}/vmlinuz -f value -c id
|
||||||
{{ centos_glance_kernel_image }}
|
{{ centos_glance_kernel_image }}
|
||||||
register: centos_kernel_id
|
register: centos_kernel_id
|
||||||
failed_when: centos_kernel_id.stdout == ""
|
failed_when: centos_kernel_id.stdout == ""
|
||||||
when: centos_glance_kernel_image is defined
|
environment:
|
||||||
|
OS_CLOUD: devstack-admin
|
||||||
|
when: centos_glance_kernel_image is defined
|
||||||
|
|
||||||
- name: Upload the CentOS initramfs image
|
- name: Upload the CentOS initramfs image
|
||||||
command: >
|
command: >
|
||||||
openstack image create --disk-format ari --container-format ari \
|
openstack image create --disk-format ari --container-format ari \
|
||||||
--public --file {{ temp_dir.path }}/initramfs -f value -c id
|
--public --file {{ temp_dir.path }}/initramfs -f value -c id
|
||||||
{{ centos_glance_initramds_image }}
|
{{ centos_glance_initramds_image }}
|
||||||
register: centos_initramfs_id
|
register: centos_initramfs_id
|
||||||
failed_when: centos_initramfs_id.stdout == ""
|
failed_when: centos_initramfs_id.stdout == ""
|
||||||
when: centos_glance_initramds_image is defined
|
environment:
|
||||||
|
OS_CLOUD: devstack-admin
|
||||||
|
when: centos_glance_initramds_image is defined
|
||||||
|
|
||||||
- name: Delete the kernel and ramdisk image files
|
- name: Delete the kernel and ramdisk image files
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ temp_dir.path }}/{{ item }}"
|
path: "{{ temp_dir.path }}/{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- vmlinuz
|
- vmlinuz
|
||||||
- initramfs
|
- initramfs
|
||||||
|
|
||||||
- name: Extract the root file system
|
- name: Extract the root file system
|
||||||
command: virt-tar-out -a {{ centos_image_file }} / {{ temp_dir.path }}/root.tar
|
command: virt-tar-out -a {{ centos_image_file }} / {{ temp_dir.path }}/root.tar
|
||||||
|
|
||||||
- name: Delete the whole-disk image file
|
- name: Delete the whole-disk image file
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ centos_image_file }}"
|
path: "{{ centos_image_file }}"
|
||||||
|
|
||||||
- name: Extract /etc/fstab and /etc/selinux/config
|
- name: Extract /etc/fstab and /etc/selinux/config
|
||||||
command: >
|
command: >
|
||||||
tar -f {{ temp_dir.path }}/root.tar
|
tar -f {{ temp_dir.path }}/root.tar
|
||||||
-C {{ temp_dir.path }} --extract {{ item }}
|
-C {{ temp_dir.path }} --extract {{ item }}
|
||||||
with_items:
|
with_items:
|
||||||
- ./etc/fstab
|
- ./etc/fstab
|
||||||
- ./etc/selinux/config
|
- ./etc/selinux/config
|
||||||
|
|
||||||
- name: Remove /etc/fstab and /etc/selinux/config from the archive
|
- name: Remove /etc/fstab and /etc/selinux/config from the archive
|
||||||
command: tar -f {{ temp_dir.path }}/root.tar --delete {{ item }}
|
command: tar -f {{ temp_dir.path }}/root.tar --delete {{ item }}
|
||||||
with_items:
|
with_items:
|
||||||
- ./etc/fstab
|
- ./etc/fstab
|
||||||
- ./etc/selinux/config
|
- ./etc/selinux/config
|
||||||
|
|
||||||
- name: Edit /etc/fstab to replace UUID with LABEL
|
- name: Edit /etc/fstab to replace UUID with LABEL
|
||||||
command: sed -i 's/UUID=[^ ]* /\/dev\/vda2 /' {{ temp_dir.path}}/etc/fstab
|
command: sed -i 's/UUID=[^ ]* /\/dev\/vda2 /' {{ temp_dir.path}}/etc/fstab
|
||||||
|
|
||||||
- name: Rewrite /etc/selinux/config to disable selinux
|
- name: Rewrite /etc/selinux/config to disable selinux
|
||||||
copy:
|
copy:
|
||||||
dest: "{{ temp_dir.path }}/etc/selinux/config"
|
dest: "{{ temp_dir.path }}/etc/selinux/config"
|
||||||
content: "SELINUX=disabled"
|
content: "SELINUX=disabled"
|
||||||
|
|
||||||
- name: Add edited /etc/fstab and /etc/selinux/config back
|
- name: Add edited /etc/fstab and /etc/selinux/config back
|
||||||
command: >
|
command: >
|
||||||
tar -f {{ temp_dir.path }}/root.tar
|
tar -f {{ temp_dir.path }}/root.tar
|
||||||
-C {{ temp_dir.path }}
|
-C {{ temp_dir.path }}
|
||||||
--append {{ item }} --owner root --group root
|
--append {{ item }} --owner root --group root
|
||||||
with_items:
|
with_items:
|
||||||
- ./etc/fstab
|
- ./etc/fstab
|
||||||
- ./etc/selinux/config
|
- ./etc/selinux/config
|
||||||
|
|
||||||
- name: Pack the root file system into a partition image
|
- name: Pack the root file system into a partition image
|
||||||
command: virt-make-fs {{ temp_dir.path }}/root.tar {{ centos_partition_file }}
|
command: virt-make-fs {{ temp_dir.path }}/root.tar {{ centos_partition_file }}
|
||||||
|
|
||||||
- name: Print filesystems from the image
|
- name: Print filesystems from the image
|
||||||
command: virt-filesystems -a {{ centos_partition_file }} -l --extra --block-devices
|
command: virt-filesystems -a {{ centos_partition_file }} -l --extra --block-devices
|
||||||
|
|
||||||
- name: Remove the temporary directory
|
- name: Remove the temporary directory
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ temp_dir.path }}"
|
path: "{{ temp_dir.path }}"
|
||||||
|
|
||||||
- name: Upload the CentOS partition image
|
- name: Upload the CentOS partition image
|
||||||
command: >
|
command: >
|
||||||
openstack image create --disk-format qcow2
|
openstack image create --disk-format qcow2
|
||||||
--public --file {{ centos_partition_file }}
|
--public --file {{ centos_partition_file }}
|
||||||
--property kernel_id={{ centos_kernel_id.stdout }}
|
--property kernel_id={{ centos_kernel_id.stdout }}
|
||||||
--property ramdisk_id={{ centos_initramfs_id.stdout }}
|
--property ramdisk_id={{ centos_initramfs_id.stdout }}
|
||||||
{{ centos_glance_root_image }}
|
{{ centos_glance_root_image }}
|
||||||
when: centos_glance_root_image is defined
|
environment:
|
||||||
|
OS_CLOUD: devstack-admin
|
||||||
|
when: centos_glance_root_image is defined
|
||||||
|
|
||||||
- name: Remove the partition image file
|
- name: Remove the partition image file
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{ centos_partition_file }}"
|
path: "{{ centos_partition_file }}"
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
- name: Perform initial setup
|
||||||
|
include: initial-setup.yaml
|
||||||
|
|
||||||
- hosts: all
|
- hosts: all
|
||||||
environment:
|
environment:
|
||||||
OS_CLOUD: devstack-admin
|
OS_CLOUD: devstack-admin
|
||||||
@ -6,8 +9,15 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- include_tasks: ssh-key.yaml
|
- include_tasks: ssh-key.yaml
|
||||||
|
|
||||||
|
- include_tasks: centos-image.yaml
|
||||||
|
when:
|
||||||
|
- metalsmith_whole_disk_image is defined
|
||||||
|
- metalsmith_partition_image is defined
|
||||||
|
|
||||||
- include_tasks: cirros-image.yaml
|
- include_tasks: cirros-image.yaml
|
||||||
when: metalsmith_whole_disk_image is not defined
|
when:
|
||||||
|
- metalsmith_whole_disk_image is undefined
|
||||||
|
- metalsmith_partition_image is undefined
|
||||||
|
|
||||||
- name: Test a whole-disk image
|
- name: Test a whole-disk image
|
||||||
include_tasks: exercise.yaml
|
include_tasks: exercise.yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user