In Tungsten Fabric CI, which is based on Zuul, we build over 5000 container images per day. Every improvement in this process reduces the load on our infrastructure and gives users faster CI jobs. It's a well understood correlation, but without convenient tooling it may be hard to effectively profile builds and detect code changes that significantly impact the performance, leading to undesired pipeline bloat.
In this presentation we will show how to track the performance of image builds in terms of time and storage, what tools to use to easily identify the most problematic points and how to measure and quantify image quality as well as possibilities for improvement. We will go from the standard Dockerfile workflow to some new tools that allow for greater control of the builds. All of this will be served in a spicy automation sauce for use both in a personal project and at scale in a CI system of a relatively large open-source project.
From a CI admin perspective, image build performance (in terms of both time and storage) is an important factor. For users/contributors this is not that crucial at first glance, because they usually make heavy use of caching during their work in the local development environment and prefer convenience over careful optimization of every image layer (they tend to focus on the outcome - wheter the app works - rather than the build process efficiency, which is quite important in the big picture of the whole CI system).
In this talk we will attempt to show techniques beneficial for both groups. I will start by showing tools and methods to easily measure and optimize image builds from the perspective of a single developer (contributor) of a container image. The tools are meant to be easily usable in a local development context (e.g. on a laptop). I will next present how the image profiling capabilities can be integrated into a CI system and provide: history/trends for the CI infra admins and a helpful insight for developers that will aid them in optimizing image builds or detecting harmful changes, without spending much time and effort on manual analysis. We will be using Tungsten Fabric's Zuul setup as an example for both the image builds and the analysis.
The talk will also aim to raise awareness of build tools other than the regular Dockerfile-based build, and present their strengths (with the goal of introducing more diversity in tooling being used among the community) - Buildah, Buildkit, Dive.