Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| ... | ... |
@@ -71,8 +71,8 @@ RUN apk --no-cache add \ |
| 71 | 71 |
tar \ |
| 72 | 72 |
xz |
| 73 | 73 |
|
| 74 |
-COPY hack/test/e2e-run.sh /scripts/run.sh |
|
| 75 |
-COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh |
|
| 74 |
+COPY hack/test/e2e-run.sh /scripts/run.sh |
|
| 75 |
+COPY hack/make/.build-empty-images /scripts/build-empty-images.sh |
|
| 76 | 76 |
|
| 77 | 77 |
COPY integration/testdata /tests/integration/testdata |
| 78 | 78 |
COPY integration/build/testdata /tests/integration/build/testdata |
| 79 | 79 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,55 @@ |
| 0 |
+#!/usr/bin/env bash |
|
| 1 |
+set -e |
|
| 2 |
+ |
|
| 3 |
+function imageNotPresent {
|
|
| 4 |
+ local img="$1" |
|
| 5 |
+ ! docker image inspect "$img" > /dev/null 2> /dev/null |
|
| 6 |
+} |
|
| 7 |
+ |
|
| 8 |
+if imageNotPresent "emptyfs"; then |
|
| 9 |
+ # build a "docker save" tarball for "emptyfs" |
|
| 10 |
+ # see https://github.com/docker/docker/pull/5262 |
|
| 11 |
+ # and also https://github.com/docker/docker/issues/4242 |
|
| 12 |
+ dir="$DEST/emptyfs" |
|
| 13 |
+ uuid=511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158 |
|
| 14 |
+ mkdir -p "$dir/$uuid" |
|
| 15 |
+ ( |
|
| 16 |
+ echo '[{"Config":"11f64303f0f7ffdc71f001788132bca5346831939a956e3e975c93267d89a16d.json","RepoTags":["emptyfs:latest"],"Layers":["511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar"]}]' > "$dir/manifest.json"
|
|
| 17 |
+ echo -n '{"architecture":"x86_64","comment":"Imported from -","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"created":"2013-06-13T14:03:50.821769-07:00","docker_version":"0.4.0","history":[{"created":"2013-06-13T14:03:50.821769-07:00","comment":"Imported from -"}],"rootfs":{"type":"layers","diff_ids":["sha256:84ff92691f909a05b224e1c56abb4864f01b4f8e3c854e4bb4c7baf1d3f6d652"]}}' > "$dir/11f64303f0f7ffdc71f001788132bca5346831939a956e3e975c93267d89a16d.json"
|
|
| 18 |
+ |
|
| 19 |
+ echo '{"emptyfs":{"latest":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"}}' > "$dir/repositories"
|
|
| 20 |
+ cd "$dir/$uuid" |
|
| 21 |
+ echo '{"id":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158","comment":"Imported from -","created":"2013-06-13T14:03:50.821769-07:00","container_config":{"Hostname":"","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"docker_version":"0.4.0","architecture":"x86_64","Size":0}' > json
|
|
| 22 |
+ echo '1.0' > VERSION |
|
| 23 |
+ tar -cf layer.tar --files-from /dev/null |
|
| 24 |
+ ) |
|
| 25 |
+ ( |
|
| 26 |
+ [ -n "$TESTDEBUG" ] && set -x |
|
| 27 |
+ tar -cC "$dir" . | docker load |
|
| 28 |
+ ) |
|
| 29 |
+ rm -rf "$dir" |
|
| 30 |
+fi |
|
| 31 |
+ |
|
| 32 |
+# without c8d image store, image id is the config's id |
|
| 33 |
+dangling_cfg=0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43 |
|
| 34 |
+# with c8d image store, image id is the id of manifest/manifest list. |
|
| 35 |
+dangling_mfst=16d365089e5c10e1673ee82ab5bba38ade9b763296ad918bd24b42a1156c5456 |
|
| 36 |
+if imageNotPresent "$dangling_cfg" && imageNotPresent "$dangling_mfst"; then |
|
| 37 |
+ dir="$DEST/dangling" |
|
| 38 |
+ mkdir -p "$dir" |
|
| 39 |
+ ( |
|
| 40 |
+ cd "$dir" |
|
| 41 |
+ printf '{"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:16d365089e5c10e1673ee82ab5bba38ade9b763296ad918bd24b42a1156c5456","size":264,"annotations":{"org.opencontainers.image.created":"2023-05-19T08:00:44Z"},"platform":{"architecture":"amd64","os":"linux"}}]}' > index.json
|
|
| 42 |
+ printf '[{"Config":"blobs/sha256/0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43","RepoTags":null,"Layers":null}]' > manifest.json
|
|
| 43 |
+ mkdir -p blobs/sha256 |
|
| 44 |
+ printf '{"schemaVersion":2,"mediaType":"application/vnd.docker.distribution.manifest.v2+json","config":{"mediaType":"application/vnd.docker.container.image.v1+json","digest":"sha256:0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43","size":390},"layers":[]}' > blobs/sha256/$dangling_mfst
|
|
| 45 |
+ printf '{"architecture":"amd64","config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"WorkingDir":"/","Labels":{"org.mobyproject.test.specialimage":"1"},"OnBuild":null},"created":null,"history":[{"created_by":"LABEL org.mobyproject.test.specialimage=1","comment":"buildkit.dockerfile.v0","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":null}}' > blobs/sha256/$dangling_cfg
|
|
| 46 |
+ tar -cf layer.tar --files-from /dev/null |
|
| 47 |
+ ) |
|
| 48 |
+ ( |
|
| 49 |
+ [ -n "$TESTDEBUG" ] && set -x |
|
| 50 |
+ tar -cC "$dir" . | docker load |
|
| 51 |
+ ) |
|
| 52 |
+ rm -rf "$dir" |
|
| 53 |
+ |
|
| 54 |
+fi |
| 0 | 55 |
deleted file mode 100644 |
| ... | ... |
@@ -1,55 +0,0 @@ |
| 1 |
-#!/usr/bin/env bash |
|
| 2 |
-set -e |
|
| 3 |
- |
|
| 4 |
-function imageNotPresent {
|
|
| 5 |
- local img="$1" |
|
| 6 |
- ! docker image inspect "$img" > /dev/null 2> /dev/null |
|
| 7 |
-} |
|
| 8 |
- |
|
| 9 |
-if imageNotPresent "emptyfs"; then |
|
| 10 |
- # build a "docker save" tarball for "emptyfs" |
|
| 11 |
- # see https://github.com/docker/docker/pull/5262 |
|
| 12 |
- # and also https://github.com/docker/docker/issues/4242 |
|
| 13 |
- dir="$DEST/emptyfs" |
|
| 14 |
- uuid=511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158 |
|
| 15 |
- mkdir -p "$dir/$uuid" |
|
| 16 |
- ( |
|
| 17 |
- echo '[{"Config":"11f64303f0f7ffdc71f001788132bca5346831939a956e3e975c93267d89a16d.json","RepoTags":["emptyfs:latest"],"Layers":["511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158/layer.tar"]}]' > "$dir/manifest.json"
|
|
| 18 |
- echo -n '{"architecture":"x86_64","comment":"Imported from -","container_config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"created":"2013-06-13T14:03:50.821769-07:00","docker_version":"0.4.0","history":[{"created":"2013-06-13T14:03:50.821769-07:00","comment":"Imported from -"}],"rootfs":{"type":"layers","diff_ids":["sha256:84ff92691f909a05b224e1c56abb4864f01b4f8e3c854e4bb4c7baf1d3f6d652"]}}' > "$dir/11f64303f0f7ffdc71f001788132bca5346831939a956e3e975c93267d89a16d.json"
|
|
| 19 |
- |
|
| 20 |
- echo '{"emptyfs":{"latest":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158"}}' > "$dir/repositories"
|
|
| 21 |
- cd "$dir/$uuid" |
|
| 22 |
- echo '{"id":"511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158","comment":"Imported from -","created":"2013-06-13T14:03:50.821769-07:00","container_config":{"Hostname":"","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":null,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":null,"Cmd":null,"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"docker_version":"0.4.0","architecture":"x86_64","Size":0}' > json
|
|
| 23 |
- echo '1.0' > VERSION |
|
| 24 |
- tar -cf layer.tar --files-from /dev/null |
|
| 25 |
- ) |
|
| 26 |
- ( |
|
| 27 |
- [ -n "$TESTDEBUG" ] && set -x |
|
| 28 |
- tar -cC "$dir" . | docker load |
|
| 29 |
- ) |
|
| 30 |
- rm -rf "$dir" |
|
| 31 |
-fi |
|
| 32 |
- |
|
| 33 |
-# without c8d image store, image id is the config's id |
|
| 34 |
-dangling_cfg=0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43 |
|
| 35 |
-# with c8d image store, image id is the id of manifest/manifest list. |
|
| 36 |
-dangling_mfst=16d365089e5c10e1673ee82ab5bba38ade9b763296ad918bd24b42a1156c5456 |
|
| 37 |
-if imageNotPresent "$dangling_cfg" && imageNotPresent "$dangling_mfst"; then |
|
| 38 |
- dir="$DEST/dangling" |
|
| 39 |
- mkdir -p "$dir" |
|
| 40 |
- ( |
|
| 41 |
- cd "$dir" |
|
| 42 |
- printf '{"schemaVersion":2,"manifests":[{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:16d365089e5c10e1673ee82ab5bba38ade9b763296ad918bd24b42a1156c5456","size":264,"annotations":{"org.opencontainers.image.created":"2023-05-19T08:00:44Z"},"platform":{"architecture":"amd64","os":"linux"}}]}' > index.json
|
|
| 43 |
- printf '[{"Config":"blobs/sha256/0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43","RepoTags":null,"Layers":null}]' > manifest.json
|
|
| 44 |
- mkdir -p blobs/sha256 |
|
| 45 |
- printf '{"schemaVersion":2,"mediaType":"application/vnd.docker.distribution.manifest.v2+json","config":{"mediaType":"application/vnd.docker.container.image.v1+json","digest":"sha256:0df1207206e5288f4a989a2f13d1f5b3c4e70467702c1d5d21dfc9f002b7bd43","size":390},"layers":[]}' > blobs/sha256/$dangling_mfst
|
|
| 46 |
- printf '{"architecture":"amd64","config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"WorkingDir":"/","Labels":{"org.mobyproject.test.specialimage":"1"},"OnBuild":null},"created":null,"history":[{"created_by":"LABEL org.mobyproject.test.specialimage=1","comment":"buildkit.dockerfile.v0","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":null}}' > blobs/sha256/$dangling_cfg
|
|
| 47 |
- tar -cf layer.tar --files-from /dev/null |
|
| 48 |
- ) |
|
| 49 |
- ( |
|
| 50 |
- [ -n "$TESTDEBUG" ] && set -x |
|
| 51 |
- tar -cC "$dir" . | docker load |
|
| 52 |
- ) |
|
| 53 |
- rm -rf "$dir" |
|
| 54 |
- |
|
| 55 |
-fi |