Merge "Consume oooci-build-images role in build-image"

This commit is contained in:
Zuul 2020-05-06 01:08:54 +00:00 committed by Gerrit Code Review
commit e9789104a4
3 changed files with 29 additions and 89 deletions

View File

@ -1,8 +1,6 @@
---
images_working_dir: /var/lib/oooq-images/{{ release }}
images_working_dir: "{{ ansible_user_dir }}/workspace"
images_destroy_working_dir: true
overcloud_image_build_script: overcloud-image-build.sh.j2
overcloud_image_build_log: overcloud_image_build.log
build_image_isolated: true
build_isolation_image_url: https://images.rdoproject.org/CentOS-7-x86_64-GenericCloud.qcow2
cleanup_images_working_dir: false
@ -13,16 +11,9 @@ build_isolation_image:
type: qcow2
build_undercloud: true
overcloud_as_undercloud: true
package_images: true
overcloud_repo_paths:
- "$(ls /etc/yum.repos.d/delorean*)"
- "$(ls /etc/yum.repos.d/CentOS-Ceph-*)"
- "$(ls /etc/yum.repos.d/centos-*)"
- "$(ls /etc/yum.repos.d/quickstart-*)"
- "$(ls {{ working_dir }}/web-gating.repo)"
image_build_yaml_paths:
- "/usr/share/tripleo-common/image-yaml/overcloud-images-centos7.yaml"
- "/usr/share/tripleo-common/image-yaml/overcloud-images.yaml"
- "/etc/yum.repos.d/delorean*"
- "/etc/yum.repos.d/quickstart-*"
image_build_extract_list:
- "/ironic-python-agent.initramfs"
- "/ironic-python-agent.kernel"

View File

@ -21,23 +21,36 @@
repo_run_live: false
repo_setup_dir: "{{ images_working_dir }}"
- name: create overcloud/ipa image build script
template:
src: "{{ overcloud_image_build_script }}"
dest: "{{ images_working_dir }}/overcloud_image_build_script.sh"
mode: 0755
- name: Check for extra repo created by repo-setup role
stat:
path: "{{ images_working_dir }}/web-gating.repo"
register: new_repo
- name: run the image build script (direct)
shell: >
set -o pipefail &&
{{ images_working_dir }}/overcloud_image_build_script.sh 2>&1 {{ timestamper_cmd }} >
{{ working_dir }}/{{ overcloud_image_build_log }}
args:
chdir: "{{ images_working_dir }}"
when: not build_image_isolated|bool
- name: Append new repo to overcloud_repo_path
set_fact:
overcloud_repo_paths: "{{ overcloud_repo_paths + [(images_working_dir + '/web-gating.repo')] }}"
when: new_repo.stat.exists
- name: Run the image build script (direct) using oooci-build-images role
vars:
dib_yum_repo_conf: "{{ overcloud_repo_paths }}"
workspace: "{{ images_working_dir }}"
build_all_images: true
tripleo_image_type: overcloud-full
tripleo_common_path: "/usr/share/tripleo-common"
include_role:
name: oooci-build-images
when:
- not build_image_isolated|bool
- to_build|bool
- when: build_image_isolated|bool
block:
- name: Make sure /dev/pts exists
shell: |
mkdir -p /dev/pts
mount devpts /dev/pts -t devpts ||:
changed_when: true
- name: get image to use as isolated build env
include: fetch-images.yml
@ -130,27 +143,6 @@
args:
chdir: "{{ images_working_dir }}"
- when: package_images|bool
block:
- name: Create overcloud and ironic-python-agent image tars
shell: |
tar -cf ironic-python-agent.tar \
ironic-python-agent.initramfs \
ironic-python-agent.kernel
tar -cf overcloud-full.tar \
overcloud-full.qcow2 \
overcloud-full.initrd \
overcloud-full.vmlinuz
args:
chdir: "{{ images_working_dir }}"
- name: Create md5sums
shell: |
md5sum ironic-python-agent.tar > ironic-python-agent.tar.md5
md5sum overcloud-full.tar > overcloud-full.tar.md5
args:
chdir: "{{ images_working_dir }}"
- name: Clean up the images working dir
shell: >-
rm -rf {{ images_working_dir }}/overcloud-full.d {{ images_working_dir }}/ironic-python-agent.d/

View File

@ -1,43 +0,0 @@
#!/bin/bash
# script to build overcloud images
set -eux
{% if build_image_isolated|bool %}
# NOTE(trown): DIB expects /dev/pts to exist and libguestfs is not mounting the guest with it
# so we just manually mount it in the guest
# This will be fixed when https://www.redhat.com/archives/libguestfs/2016-December/msg00024.html
# is available in CentOS version of libguestfs
# This fix is now available in 7.4 libguestfs-1.36.3-6.el7_4.3.x86_64
# so workaround was modified to work with both.
mkdir -p /dev/pts
mount devpts /dev/pts -t devpts ||:
{% endif %}
sudo yum -y install python-tripleoclient
# TODO(gcerami): remove after https://bugs.launchpad.net/tripleo/+bug/1818305
# has a root cause
export DIB_DEBUG_TRACE=1
export DIB_YUM_REPO_CONF=""
{% for repo_path in overcloud_repo_paths %}
export DIB_YUM_REPO_CONF="$DIB_YUM_REPO_CONF {{ repo_path }}"
{% endfor %}
{% if base_image_url is defined and base_image_path is defined %}
curl -Lo {{ base_image_path }} {{ base_image_url }}
export DIB_LOCAL_IMAGE={{ base_image_path }}
{% endif %}
{# note(trown): there was not support in tripleoclient for YAML config images in Newton #}
{% if release == 'newton'-%}
tripleo-build-images \
{% for yaml_path in image_build_yaml_paths -%}
--image-config-file {{ yaml_path }} \
{% endfor -%}
{% else -%}
openstack overcloud image build{% if not skip_build_images %} --no-skip{% endif %} \
{% for yaml_path in image_build_yaml_paths -%}
--config-file {{ yaml_path }} \
{% endfor -%}
{% endif -%}