From 28453dc3c372d027edb742a5352f23288f0ef63f Mon Sep 17 00:00:00 2001 From: Urvashi Mohnani Date: Thu, 4 Feb 2021 14:14:59 -0500 Subject: [PATCH] Fix build arg check Fix the check on build args to be the length of the map and not whether the map is nil. The nil check was causing the cache layer to not be used as it would give a false result. Signed-off-by: Urvashi Mohnani --- imagebuildah/stage_executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imagebuildah/stage_executor.go b/imagebuildah/stage_executor.go index 9c15785bcd4..e195a797860 100644 --- a/imagebuildah/stage_executor.go +++ b/imagebuildah/stage_executor.go @@ -838,7 +838,7 @@ func (s *StageExecutor) Execute(ctx context.Context, base string) (imgID string, // we need to call ib.Run() to correctly put the args together before // determining if a cached layer with the same build args already exists // and that is done in the if block below. - if checkForLayers && s.builder.Args == nil { + if checkForLayers && len(s.builder.Args) == 0 { cacheID, err = s.intermediateImageExists(ctx, node, addedContentSummary, s.stepRequiresLayer(step)) if err != nil { return "", nil, errors.Wrap(err, "error checking if cached image exists from a previous build")