# Replace build-images role to oooci-build-images role
###### tags: `Design`
## Problem Statement
* build-images : https://opendev.org/openstack/tripleo-quickstart-extras/src/branch/master/roles/build-images
* oooci-build-images: https://opendev.org/openstack/tripleo-ci/src/branch/master/roles/oooci-build-images
### what it does?
* build-images: An ansible role for building undercloud and overcloud images using python-tripleoclient or using libguestfs-tools inside a libvirt guest inside an isolated environment.
* oooci-build-images: An ansible role for building overcloud images using python-tripleoclient.
### Where it is consumed?
* build-images: It is used in featureset 002 till train release on CentOS-7 based jobs.
* In invoke this role, we use to_build: true in featureset 002 - https://opendev.org/openstack/tripleo-quickstart/src/branch/master/config/general_config/featureset002.yml#L13
* then it triggers this playbook
* https://opendev.org/openstack/tripleo-quickstart-extras/src/branch/master/playbooks/baremetal-full-undercloud.yml#L38
* Once image build finishes then images are consumed in fs02 deployment
* Once the deployment passes, then we create the undercloud image from overcloud before uploading the image to image server here on libvirt guest here using convert-image role
* https://github.com/rdo-infra/review.rdoproject.org-config/blob/master/ci-scripts/tripleo-upstream/convert-upload-undercloud.sh#L18
* https://opendev.org/openstack/tripleo-quickstart/src/branch/master/roles/convert-image
* oooci-build-images: we have seperate jobs for building overcloud and ipa images
* periodic-tripleo-centos-8-buildimage-ironic-python-agent-master
* periodic-tripleo-centos-8-buildimage-overcloud-full-master
* Once the images are built, they are pushed to image server (https://images.rdoproject.org) and then consumed in ovb jobs like fs01 and fs020
### What is repeated in both roles?
* Building the overcloud images is common in both roles using python-tripleoclient.
* That brings code duplicacy and maintaince of same stuff at two places. So we want to re-use oooci-build-images role in build-images role to avoid duplicacy.
## How to solve this problem?
### considerations.
* Make sure oooci-build-images works for all the supported releases.
* It means it should work on both C7 and C8 based jobs
* Building overcloud images can be enabled via to_build flag
### What to change in build_images role?
* replace generate build_image script and run build_images script with oooci-build-images
* https://opendev.org/openstack/tripleo-quickstart-extras/src/branch/master/roles/build-images/templates/overcloud-image-build.sh.j2 with https://review.opendev.org/#/c/719453/
## Questions?
* What to do with featurset002 for master centos-8 job?
* in build-images role, building overcloud images using libguestfs tool is there, but not tested anywhere, what to do with that?
* in fs02, during post deployment, we build undercloud images from overcloud before uploading the image to image server do we want to continue that?
* https://github.com/rdo-infra/review.rdoproject.org-config/blob/master/ci-scripts/tripleo-upstream/convert-upload-undercloud.sh#L18