From 7ef5705c261db3bc12541310f111cb4eca0b68d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Joulaud?= Date: Thu, 9 Jan 2025 13:02:03 +0100 Subject: [PATCH] fix: child image should be rebuildable The Filter function constructs a completely new graph were unmodified images are 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 which is too complicated for our sake and does not really improves the performances. Fixes be5509e34ab6ce172a61943ed2152ee7cd734b48 --- pkg/dib/build.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/dib/build.go b/pkg/dib/build.go index 161426c75..96158e504 100644 --- a/pkg/dib/build.go +++ b/pkg/dib/build.go @@ -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