Skip to content

Commit

Permalink
fix impossibility to rebuild only child images
Browse files Browse the repository at this point in the history
The Filter function rebuild a completely new graph were unmodified images are
completely discarded. I suppose it was done to have a (very) smaller graph to
improve (a little) performance.

Unfortunately, we need info on all direct parents images when rebuilding, at
least to properly amend the FROM line to be able to pull the right parent
image. Thus this refacto broke completely rebuild of every image with at least
one not-to-rebuild parent.

I fix this quickly by avoiding the Filter function altogether.

If the graph reduction were deemed useful it would be needed to discard only
nodes which are not modified *and* which have no modified descendants. But I
felt it was to complicated for me.

Fixes be5509e
  • Loading branch information
joulaud committed Jan 9, 2025
1 parent 40c866c commit b96099f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/dib/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ func (p *Builder) rebuildGraph(
buildArgs map[string]string,
) {
p.Graph.
Filter(
func(node *dag.Node) bool {
return node.Image.NeedsRebuild || node.Image.NeedsTests
}).
WalkParallel(
func(node *dag.Node) {
img := node.Image
if !(img.NeedsRebuild || img.NeedsTests) {
img.RebuildFailed = false
return
}
buildReport := report.BuildReport{Image: *img}

// Return if any parent build failed
Expand Down

0 comments on commit b96099f

Please sign in to comment.