You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 3, 2025. It is now read-only.
Cached COPY layers are expensive in that they both need to be retrieved
over the network and occupy space in the layer cache.
They are unnecessary in that we already have all resources needed to
execute the COPY locally, and doing so is a trivial file-system
operation. This is in contrast to RUN layers, which can do
arbitrary and unbounded work.
The end result is that cached COPY commands were more expensive when
cached, not less. Remove them.
Resolves#1357
desctiption: "with image one layer which has no tar content",
335
-
expectErr: false, // this one probably should fail but doesn't because of how ExecuteCommand and util.GetFSFromLayers are implemented - cvgw- 2019-11-25
336
-
expectLayer: true,
337
-
}
338
-
tc.command=c
339
-
returntc
340
-
}(),
341
-
}
342
-
343
-
for_, tc:=rangetestCases {
344
-
t.Run(tc.desctiption, func(t*testing.T) {
345
-
c:=tc.command
346
-
err:=c.ExecuteCommand(config, buildArgs)
347
-
if!tc.expectErr&&err!=nil {
348
-
t.Errorf("Expected err to be nil but was %v", err)
349
-
} elseiftc.expectErr&&err==nil {
350
-
t.Error("Expected err but was nil")
351
-
}
352
-
353
-
iftc.count!=nil {
354
-
if*tc.count!=tc.expectedCount {
355
-
t.Errorf("Expected extractFn to be called %v times but was called %v times", tc.expectedCount, *tc.count)
356
-
}
357
-
for_, file:=rangetc.extractedFiles {
358
-
match:=false
359
-
cFiles:=c.FilesToSnapshot()
360
-
for_, cFile:=rangecFiles {
361
-
iffile==cFile {
362
-
match=true
363
-
break
364
-
}
365
-
}
366
-
if!match {
367
-
t.Errorf("Expected extracted files to include %v but did not %v", file, cFiles)
368
-
}
369
-
}
370
-
371
-
cmdFiles, err:=c.FilesUsedFromContext(
372
-
config, buildArgs,
373
-
)
374
-
iferr!=nil {
375
-
t.Errorf("failed to get files used from context from command %v", err)
376
-
}
377
-
378
-
iflen(cmdFiles) !=len(tc.contextFiles) {
379
-
t.Errorf("expected files used from context to equal %v but was %v", tc.contextFiles, cmdFiles)
380
-
}
381
-
}
382
-
383
-
ifc.layer==nil&&tc.expectLayer {
384
-
t.Error("expected the command to have a layer set but instead was nil")
385
-
} elseifc.layer!=nil&&!tc.expectLayer {
386
-
t.Error("expected the command to have no layer set but instead found a layer")
0 commit comments