<div dir="ltr"><div dir="ltr">On Tue, Mar 10, 2020 at 10:41 AM Monty Taylor <<a href="mailto:mordred@inaugust.com" target="_blank">mordred@inaugust.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Yay!<br>
<br>
When you have brainspace after firefighting (always fun) - maybe we should find a time to talk about whether our image building and publishing automation could help you out here. No rush - this is one of those “we’ve got some tools we might be able to leverage to help” - just ping me whenever.<br></blockquote><div><br></div><div>Hey Monty,</div><div><br></div><div>The CI team is presently busy with CentOS 8 fires but I would be happy to help and work together on convergence.<br></div></div><div>Maybe I can start by explaining how our process works, then you can do the same and we see where we can collaborate.</div><div><br></div><div>The TL;DR is that we have built TripleO CLI and Ansible roles to consume Kolla tooling and build our images.</div><div><br></div><div>1) How a TripleO user would build an image?</div><div><br></div><div>By using the "openstack overcloud container image build" command ("overcloud" is here by legacy, please ignore it).</div><div>The magic happens here:</div><div><a href="https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/v1/container_image.py#L104-L252" target="_blank">https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/v1/container_image.py#L104-L252</a></div><div>It's basically wrapping out the kolla-build CLI; with proper options for us.</div><div>In fact, since podman/buildah, we only use kolla-build to render Kolla Dockerfiles templates to merge them with our TripleO overrides:</div><div><a href="https://opendev.org/openstack/tripleo-common/src/branch/master/container-images/tripleo_kolla_template_overrides.j2" target="_blank">https://opendev.org/openstack/tripleo-common/src/branch/master/container-images/tripleo_kolla_template_overrides.j2</a></div><div><br></div><div>kolla-build would generate directories for each image and inside you would have their Dockerfiles.</div><div>We don't use kolla-build to build the containers because Kolla doesn't support Buildah, and none of us has taken the time to do it yet.<br></div><div><br></div><div>To build the images from Dockerfiles, we use that code:</div><div><a href="https://opendev.org/openstack/tripleo-common/src/branch/master/tripleo_common/image/builder/buildah.py" target="_blank">https://opendev.org/openstack/tripleo-common/src/branch/master/tripleo_common/image/builder/buildah.py</a></div><div><br></div><div>It's basically running "buildah bud" with concurrency (to make it faster). This code could be converted to an Ansible module eventually; which could be consumed by more than us.</div><div>Once images are built, the code runs "buildah push"; to push it to a remote (or local) registry.</div><div><br></div><div>That's it, that's all. If we resume, we use kolla-build to generate Dockerfiles for our containers (since TripleO images use Kolla format) and then we have our own crap to use Buildah to build & push the image. I guess the second part is something we could share.</div><div><br></div><div><br></div><div>2) How TripleO CI builds containers?<br></div><div><br></div><div>We have an Ansible role for that:</div><div><a href="https://opendev.org/openstack/tripleo-ci/src/branch/master/roles/build-containers">https://opendev.org/openstack/tripleo-ci/src/branch/master/roles/build-containers</a></div><div><br></div><div>It basically:</div><div>- Install repositories needed to deploy TripleO</div><div>- Deploy a local docker registry with ansible-role-container-registry (also used in production when Docker is deployed, so before Stein)<br></div><div>- Install and configure Kolla</div><div>- Runs "openstack overcloud container image build" (which was described earlier) to build, tag and push images</div><div><br></div><div>I skipped a few details but this is the big picture. I'm sure there is a lot where we can share and I would be more than happy to contribute in that effort, please let me know how it works on your side and we'll find ways to collaborate.</div><div><br></div><div>Thanks,<br></div><div><div>-- <br><div dir="ltr"><div dir="ltr">Emilien Macchi<br></div></div></div></div></div>