Fix exporting of Docker image layers
The logic to extract layers from a downloaded Docker image assumed that the layer entries in the image tar archive always had the file extension `.tar`. This was the case with Docker and other compatible daemons until Docker 25.0. With this commit, the extension is no longer assumed, but any entries listed in `manifest.json` will be recognized. Fixes gh-39323
This commit is contained in:
@@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -189,6 +190,7 @@ class ImageBuildpackTests extends AbstractJsonTests {
|
||||
tarOut.finish();
|
||||
}
|
||||
consumer.accept("test", tarFile.toPath());
|
||||
Files.delete(tarFile.toPath());
|
||||
}
|
||||
catch (IOException ex) {
|
||||
fail("Error writing mock layers", ex);
|
||||
|
||||
@@ -382,6 +382,7 @@ class DockerApiTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("removal")
|
||||
void exportLayerFilesDeletesTempFiles() throws Exception {
|
||||
ImageReference reference = ImageReference.of("gcr.io/paketo-buildpacks/builder:base");
|
||||
URI exportUri = new URI(IMAGES_URL + "/gcr.io/paketo-buildpacks/builder:base/get");
|
||||
|
||||
Reference in New Issue
Block a user