Repository navigation
Conversation
Open
gmpinder
force-pushed
the
next-builder
branch
11 times, most recently
from
September 20, 2026 17:58
42ad195 to
84b7cf4
Compare
gmpinder
force-pushed
the
next-builder
branch
6 times, most recently
from
September 27, 2026 23:36
5a058e0 to
48f4d0f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the start of the new build engine that will be replacing the existing, what I'd like to call, legacy build system. This feature makes use of the individual layer control that
buildahgives you.Layers
The pattern I went with is a DAG structure that holds the instructions for running each step or
Layer. This makes it so that you can construct a build "plan" without invoking the build immediately. There are several layers types that we will start with and can expand in the future if we want special build steps. Those types are:FromLayerFROMLayerId) to start fromRunLayerRUNinstructionCopyLayerCOPYinstructionUnshareLayerContainerfilebuildah unsharecommandBB_UNSHARE_MOUNTBuild step state machine
When using
buildah from, a new working container is produced and you are able to run any series of commands in that container likebuildah runorbuildah copy. A layer isn't created untilbuildah commitis ran on the working container. When the image is committed, aLayerIdis produced that can be used to create another layer ontop. So when it comes to doing a squashed build, you are basically holding off on runningbuildah commituntil the end. That way you create a single layer on top of your base image.In order to track that state, I had to create a struct that would hold that information and enforce a state-machine operation so that a squashed build couldn't accidentally turn into a layered build mid-way. To do that I created the
BuildStepstruct. This object can contain either aContainerorLayerIdobject as it is passed up the stack to the end of the build. In this struct I make use of thePhantomDatamarker type. This allows me to use a unit struct likeReadyStateorRunningLayeredStateto mark where we are in the build. I then created some traits that have implementations for a set combination of generics onBuildStepso that when you call.container()on aBuildStep<LayerId, ReadyState>, it takes owner ship and returns a(Container, BuildStep<(), RunningLayeredState>)tuple. This allows us to run aLayeron thatContainer. Once we are done with that container, we pass it back into theBuildStepwith.commit(container)to produce aBuildStep<LayerId, ReadyState>to pass on to the next layer.This struct will allow us to attach context to the build as we need and to ensure that we don't call
buildahin the wrong order. One of the things that I will want to use it for before we release this is to attach the number of steps in that are in a stage, the current step index we're on, the image name, and the log header color. This would allow us to make use ofindicatifto show a progress bar for each stage in the build.Tasks to get to parity
cosign,bluebuild, andnushell