Skip to content

Commit a714657

Browse files
committed
fix: skip merging if no dependencies found
Dependency resolving is complicated, bldr might skip even declared dependencies (if they got promoted to the base image). This fixes the check to avoid merging if only one layer will be present. Signed-off-by: Andrey Smirnov <[email protected]>
1 parent cedc88a commit a714657

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/pkg/convert/node.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ func (node *NodeLLB) convertDependency(dep solver.PackageDependency) (depState l
122122
}
123123

124124
func (node *NodeLLB) dependencies(root llb.State) (llb.State, error) {
125-
if len(node.Dependencies) == 0 {
126-
return root, nil
127-
}
128-
129125
deps := make([]solver.PackageDependency, 0, len(node.Dependencies))
130126

131127
// collect all the dependencies including transitive runtime dependencies
@@ -176,6 +172,10 @@ func (node *NodeLLB) dependencies(root llb.State) (llb.State, error) {
176172
}
177173
}
178174

175+
if len(stages) == 1 {
176+
return root, nil
177+
}
178+
179179
return root.WithOutput(llb.Merge(stages, llb.WithCustomName(node.Prefix+"copy")).Output()), nil
180180
}
181181

0 commit comments

Comments
 (0)