Skip to content

Commit

Permalink
Return the full list of descriptors in build metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Oct 25, 2024
1 parent 185751b commit 24317a6
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
7 changes: 7 additions & 0 deletions cmd/buildctl/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ func testBuildMetadataFile(t *testing.T, sb integration.Sandbox) {
require.NotEmpty(t, desc.MediaType)
require.NotEmpty(t, desc.Digest.String())

require.Contains(t, metadata, exptypes.ExporterImageDescriptorsKey)
var descList []*ocispecs.Descriptor
dtdescList, err := json.Marshal(metadata[exptypes.ExporterImageDescriptorsKey])
require.NoError(t, err)
err = json.Unmarshal(dtdescList, &descList)
require.NoError(t, err)

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd, ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend, integration)

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=containerd

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=containerd === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=containerd === CONT TestCLIIntegration/TestBuildMetadataFile/worker=containerd build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=containerd sandbox.go:135: stdout: /usr/bin/buildkitd --containerd-worker-gc=false --containerd-worker=true --containerd-worker-addr /tmp/bktest_containerd3001934990/containerd.sock --containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker=false --config=/tmp/bktest_config325987809/buildkitd.toml --root /tmp/bktest_buildkitd1301926274 --addr unix:///tmp/bktest_buildkitd1301926274/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --containerd-worker-gc=false --containerd-worker=true --containerd-worker-addr /tmp/bktest_containerd3001934990/containerd.sock --containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker=false --config=/tmp/bktest_config325987809/buildkitd.toml --root /tmp/bktest_buildkitd1301926274 --addr unix:///tmp/bktest_buildkitd1301926274/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-28 13:51:03.375664332 +0000 UTC m=+1.569405692 /usr/bin/buildkitd --containerd-worker-gc=false --containerd-worker=true --containerd-worker-addr /tmp/bktest_containerd3001934990/containerd.sock --containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker=false --config=/tmp/bktest_config325987809/buildkitd.toml --root /tmp/bktest_buildkitd1301926274 --addr unix:///tmp/bktest_buildkitd1301926274/buildkitd.sock --debug sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="could not read \"/tmp/bktest_buildkitd1301926274/net/cni\" for cleanup: open /tmp/bktest_buildkitd1301926274/net/cni: no such file or directory" sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="creating new network namespace 37p011ywxbvr5b7gii4efq8nt" sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="finished creating network namespace 37p011ywxbvr5b7gii4efq8nt" sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="finished setting up network namespace 37p011ywxbvr5b7gii4efq8nt" sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="remote introspection plugin filters" filters="[type==io.containerd.runtime.v1 type==io.containerd.runtime.v2]" sandbox.go:138: time="2024-10-28T13:51:03Z" level=info msg="found worker \"2qy57x7wcz91sehikqcvt3olb\", labels=map[org.mobyproject.buildkit.worker.containerd.namespace:buildkit org.mobyproject.buildkit.worker.containerd.uuid:4221f19b-1273-4129-a1df-a2465a77e96b org.mobyproject.buildkit.worker.executor:containerd org.mobyproject.buildkit.worker.hostname:3f30e7c2e884 org.mobyproject.buildkit.worker.network:cni org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-28T13:51:03Z" level=info msg="found 1 workers, default=\"2qy57x7wcz91sehikqcvt3olb\"" sandbox.go:138: time="2024-10-28T13:51:03Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-28T13:51:03Z" level=info msg="running server on /tmp/bktest_buildkitd1301926274/buildkitd.sock" sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="session started" spanID=7050f82b714b2270 traceID=2d17732164e1e458d5730dd0ce301481 sandbox.go:138: time="2024-10-28T13:51:03Z" level=debug msg="resolve exporter image with map[name:example.com/moby/meta

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-rootless, ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend, integr...

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=containerd-rootless

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=containerd-rootless === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=containerd-rootless === CONT TestCLIIntegration/TestBuildMetadataFile/worker=containerd-rootless build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=containerd-rootless sandbox.go:135: stdout: /usr/bin/sudo -u #1000 -i CONTAINERD_ROOTLESS_ROOTLESSKIT_STATE_DIR=/tmp/bktest_containerd1193998727/rootlesskit-containerd CONTAINERD_ROOTLESS_ROOTLESSKIT_NET=host CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=none CONTAINERD_ROOTLESS_ROOTLESSKIT_FLAGS=--mtu=0 containerd-rootless.sh -c /tmp/bktest_containerd1193998727/config.toml sandbox.go:135: stderr: /usr/bin/sudo -u #1000 -i CONTAINERD_ROOTLESS_ROOTLESSKIT_STATE_DIR=/tmp/bktest_containerd1193998727/rootlesskit-containerd CONTAINERD_ROOTLESS_ROOTLESSKIT_NET=host CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=none CONTAINERD_ROOTLESS_ROOTLESSKIT_FLAGS=--mtu=0 containerd-rootless.sh -c /tmp/bktest_containerd1193998727/config.toml sandbox.go:138: > StartCmd 2024-10-28 13:51:37.352170421 +0000 UTC m=+0.069600002 /usr/bin/sudo -u #1000 -i CONTAINERD_ROOTLESS_ROOTLESSKIT_STATE_DIR=/tmp/bktest_containerd1193998727/rootlesskit-containerd CONTAINERD_ROOTLESS_ROOTLESSKIT_NET=host CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=none CONTAINERD_ROOTLESS_ROOTLESSKIT_FLAGS=--mtu=0 containerd-rootless.sh -c /tmp/bktest_containerd1193998727/config.toml sandbox.go:138: time="2024-10-28T13:51:37Z" level=warning msg="containerd config version `1` has been deprecated and will be converted on each startup in containerd v2.0, use `containerd config migrate` after upgrading to containerd 2.0 to avoid conversion on startup" sandbox.go:138: time="2024-10-28T13:51:37.575473241Z" level=info msg="starting containerd" revision=7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c version=v1.7.22 sandbox.go:138: time="2024-10-28T13:51:37.665622463Z" level=info msg="loading plugin \"io.containerd.event.v1.exchange\"..." type=io.containerd.event.v1 sandbox.go:138: time="2024-10-28T13:51:37.665682395Z" level=info msg="loading plugin \"io.containerd.internal.v1.opt\"..." type=io.containerd.internal.v1 sandbox.go:138: time="2024-10-28T13:51:37.665734402Z" level=warning msg="failed to load plugin io.containerd.internal.v1.opt" error="mkdir /opt/containerd: permission denied" sandbox.go:138: time="2024-10-28T13:51:37.665753558Z" level=info msg="loading plugin \"io.containerd.warning.v1.deprecations\"..." type=io.containerd.warning.v1 sandbox.go:138: time="2024-10-28T13:51:37.665778755Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.blockfile\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:37.665882118Z" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.blockfile\"..." error="no scratch file generator: skip plugin" type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:37.665909028Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.devmapper\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:37.665931891Z" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.devmapper\"..." error="devmapper not configured: skip plugin" type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:37.665950376Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.native\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:37.666065340Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.overlayfs\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:37.666346236Z" level=info

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-1.6, ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend, integration)

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=containerd-1.6

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=containerd-1.6 === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=containerd-1.6 === CONT TestCLIIntegration/TestBuildMetadataFile/worker=containerd-1.6 build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=containerd-1.6 sandbox.go:135: stdout: /opt/containerd-alt-16/bin/containerd --config /tmp/bktest_containerd4017964619/config.toml sandbox.go:135: stderr: /opt/containerd-alt-16/bin/containerd --config /tmp/bktest_containerd4017964619/config.toml sandbox.go:138: > StartCmd 2024-10-28 13:51:11.003259896 +0000 UTC m=+0.082304351 /opt/containerd-alt-16/bin/containerd --config /tmp/bktest_containerd4017964619/config.toml sandbox.go:138: time="2024-10-28T13:51:11Z" level=warning msg="containerd config version `1` has been deprecated and will be converted on each startup in containerd v2.0, use `containerd config migrate` after upgrading to containerd 2.0 to avoid conversion on startup" sandbox.go:138: time="2024-10-28T13:51:11.075904313Z" level=info msg="starting containerd" revision=88c3d9bc5b5a193f40b7c14fa996d23532d6f956 version=v1.6.36 sandbox.go:138: time="2024-10-28T13:51:11.140492258Z" level=info msg="loading plugin \"io.containerd.content.v1.content\"..." type=io.containerd.content.v1 sandbox.go:138: time="2024-10-28T13:51:11.144508511Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.devmapper\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.144540951Z" level=warning msg="failed to load plugin io.containerd.snapshotter.v1.devmapper" error="devmapper not configured" sandbox.go:138: time="2024-10-28T13:51:11.144555118Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.native\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.144663118Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.overlayfs\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.144934823Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.aufs\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.150024562Z" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.aufs\"..." error="aufs is not supported (modprobe aufs failed: exit status 1 \"modprobe: can't change directory to '/lib/modules': No such file or directory\\n\"): skip plugin" type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.150059266Z" level=info msg="loading plugin \"io.containerd.snapshotter.v1.zfs\"..." type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.150568463Z" level=info msg="skip loading plugin \"io.containerd.snapshotter.v1.zfs\"..." error="path /tmp/bktest_containerd4017964619/root/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1 sandbox.go:138: time="2024-10-28T13:51:11.150595633Z" level=info msg="loading plugin \"io.containerd.metadata.v1.bolt\"..." type=io.containerd.metadata.v1 sandbox.go:138: time="2024-10-28T13:51:11.152189705Z" level=warning msg="could not use snapshotter devmapper in metadata plugin" error="devmapper not configured" sandbox.go:138: time="2024-10-28T13:51:11.152218209Z" level=info msg="metadata content store policy set" policy=shared sandbox.go:138: time="2024-10-28T13:51:11.163102976Z" level=info msg="loading plugin \"io.containerd.differ.v1.walking\"..." type=io.containerd.differ.v1 sandbox.go:138: time="2024-10-28T13:51:11.163142409Z" level=info msg="loading plugin \"io.containerd.event.v1.exchange\"..." type=io.containerd.

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (containerd-snapshotter-stargz, ./client ./cmd/buildctl ./worker/containerd ./solver ./fronte...

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=containerd-snapshotter-stargz

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=containerd-snapshotter-stargz === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=containerd-snapshotter-stargz === CONT TestCLIIntegration/TestBuildMetadataFile/worker=containerd-snapshotter-stargz build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=containerd-snapshotter-stargz sandbox.go:135: stderr: /usr/bin/buildkitd --containerd-worker-gc=false --containerd-worker=true --containerd-worker-addr /tmp/bktest_containerd1536485728/containerd.sock --containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker=false --containerd-worker-snapshotter=stargz --config=/tmp/bktest_config275923799/buildkitd.toml --root /tmp/bktest_buildkitd198237393 --addr unix:///tmp/bktest_buildkitd198237393/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-28 13:51:18.208273704 +0000 UTC m=+0.341462854 /usr/bin/buildkitd --containerd-worker-gc=false --containerd-worker=true --containerd-worker-addr /tmp/bktest_containerd1536485728/containerd.sock --containerd-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker=false --containerd-worker-snapshotter=stargz --config=/tmp/bktest_config275923799/buildkitd.toml --root /tmp/bktest_buildkitd198237393 --addr unix:///tmp/bktest_buildkitd198237393/buildkitd.sock --debug sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="could not read \"/tmp/bktest_buildkitd198237393/net/cni\" for cleanup: open /tmp/bktest_buildkitd198237393/net/cni: no such file or directory" sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="creating new network namespace i890lodi1tz0uat3jgliczlzf" sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="finished creating network namespace i890lodi1tz0uat3jgliczlzf" sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="finished setting up network namespace i890lodi1tz0uat3jgliczlzf" sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="remote introspection plugin filters" filters="[type==io.containerd.runtime.v1 type==io.containerd.runtime.v2]" sandbox.go:138: time="2024-10-28T13:51:18Z" level=info msg="found worker \"2vs9jzjg6v0o1aavk600q04cp\", labels=map[org.mobyproject.buildkit.worker.containerd.namespace:buildkit org.mobyproject.buildkit.worker.containerd.uuid:27a9091a-4fa9-46c2-963c-9aef52ad5f66 org.mobyproject.buildkit.worker.executor:containerd org.mobyproject.buildkit.worker.hostname:b9d1694d7817 org.mobyproject.buildkit.worker.network:cni org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:stargz], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-28T13:51:18Z" level=info msg="found 1 workers, default=\"2vs9jzjg6v0o1aavk600q04cp\"" sandbox.go:138: time="2024-10-28T13:51:18Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-28T13:51:18Z" level=info msg="running server on /tmp/bktest_buildkitd198237393/buildkitd.sock" sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="resolve exporter image with map[name:example.com/moby/metadata:test push:false]" spanID=f0689dd328ee9703 traceID=880a469db2152d1624f379affc22492d sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="session started" spanID=ecacaf893f40aeb6 traceID=880a469db2152d1624f379affc22492d sandbox.go:138: time="2024-10-28T13:51:18Z" level=debug msg="checked for cached auth handler namespace" cached=false key="docker.io/library/busybox::pull" name=docker.io/library/busybox scop

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci, ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend, integration)

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=oci

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=oci === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=oci === CONT TestCLIIntegration/TestBuildMetadataFile/worker=oci build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=oci sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config2130632830/buildkitd.toml --root /tmp/bktest_buildkitd1611909135 --addr unix:///tmp/bktest_buildkitd1611909135/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config2130632830/buildkitd.toml --root /tmp/bktest_buildkitd1611909135 --addr unix:///tmp/bktest_buildkitd1611909135/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-28 13:51:24.614542649 +0000 UTC m=+0.226846935 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config2130632830/buildkitd.toml --root /tmp/bktest_buildkitd1611909135 --addr unix:///tmp/bktest_buildkitd1611909135/buildkitd.sock --debug sandbox.go:138: time="2024-10-28T13:51:24Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-28T13:51:24Z" level=debug msg="could not read \"/tmp/bktest_buildkitd1611909135/net/cni\" for cleanup: open /tmp/bktest_buildkitd1611909135/net/cni: no such file or directory" sandbox.go:138: time="2024-10-28T13:51:24Z" level=debug msg="creating new network namespace aj8kyvti73ibf2lj4yvbhil1c" sandbox.go:138: time="2024-10-28T13:51:24Z" level=debug msg="finished creating network namespace aj8kyvti73ibf2lj4yvbhil1c" sandbox.go:138: time="2024-10-28T13:51:25Z" level=debug msg="finished setting up network namespace aj8kyvti73ibf2lj4yvbhil1c" sandbox.go:138: time="2024-10-28T13:51:25Z" level=info msg="found worker \"a4xv55yn2p4xin5g4oi4vbhh7\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:6e34667f5fe0 org.mobyproject.buildkit.worker.network:cni org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-28T13:51:25Z" level=info msg="found 1 workers, default=\"a4xv55yn2p4xin5g4oi4vbhh7\"" sandbox.go:138: time="2024-10-28T13:51:25Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-28T13:51:25Z" level=info msg="running server on /tmp/bktest_buildkitd1611909135/buildkitd.sock" sandbox.go:138: time="2024-10-28T13:51:25Z" level=debug msg="resolve exporter image with map[name:example.com/moby/metadata:test push:false]" spanID=fb8e3edb98e1df44 traceID=783ddc1b3547b410399bf375d94ef79e sandbox.go:138: time="2024-10-28T13:51:25Z" level=debug msg="session started" spanID=d90ab24bd7cfd4dc traceID=783ddc1b3547b410399bf375d94ef79e sandbox.go:138: time="2024-10-28T13:51:25Z" level=debug msg="checked for cached auth handler namespace" cached=false key="docker.io/library/busybox::pull" name=docker.io/library/busybox scope=pull sandbox.go:138: time="2024-10-28T13:51:25Z" level=debug msg=resolving host="localhost:41639" spanID=fb8e3edb98e1df44 traceID=783ddc1b3547b410399bf375d94ef79e sandbox.

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci-rootless, ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend, integration)

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless === CONT TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless sandbox.go:135: stdout: /usr/bin/sudo -u #1000 -i -- exec rootlesskit buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config3969250351/buildkitd.toml --root /tmp/bktest_buildkitd1873543974 --addr unix:///tmp/bktest_buildkitd1873543974/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/sudo -u #1000 -i -- exec rootlesskit buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config3969250351/buildkitd.toml --root /tmp/bktest_buildkitd1873543974 --addr unix:///tmp/bktest_buildkitd1873543974/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-28 13:51:01.308499549 +0000 UTC m=+0.065036982 /usr/bin/sudo -u #1000 -i -- exec rootlesskit buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config3969250351/buildkitd.toml --root /tmp/bktest_buildkitd1873543974 --addr unix:///tmp/bktest_buildkitd1873543974/buildkitd.sock --debug sandbox.go:138: warning: GOCOVERDIR not set, no coverage data emitted sandbox.go:138: time="2024-10-28T13:51:01Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-28T13:51:01Z" level=debug msg="running in rootless mode" sandbox.go:138: time="2024-10-28T13:51:01Z" level=info msg="found worker \"i2kq18jb26ott8ewczbhruph5\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:4787f216d787 org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-28T13:51:01Z" level=info msg="found 1 workers, default=\"i2kq18jb26ott8ewczbhruph5\"" sandbox.go:138: time="2024-10-28T13:51:01Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-28T13:51:01Z" level=info msg="running server on /tmp/bktest_buildkitd1873543974/buildkitd.sock" sandbox.go:138: time="2024-10-28T13:51:01Z" level=debug msg="session started" spanID=d21cbc08d2cc91f0 traceID=73b66ed709f7ec6dccfe985a805b6da3 sandbox.go:138: time="2024-10-28T13:51:01Z" level=debug msg="resolve exporter image with map[name:example.com/moby/metadata:test push:false]" spanID=bd92a3ad1cb47db1 traceID=73b66ed709f7ec6dccfe985a805b6da3 sandbox.go:138: time="2024-10-28T13:51:01Z" level=debug msg="checked for cached auth handler namespace" cached=false key="docker.io/library/busybox::pull" name=docker.io/library/busybox scope=pull sandbox.go:138: time="2024-10-28T13:51:01Z" level=debug msg=resolving host="localhost:37579" spanID=bd92a3ad1cb47db1 traceID=73b66ed709f7ec6dccfe985a805b6da3 sandbox.go:138: time="2024-10-28T13:51:01Z" level=debug msg="do request" host="localhost:37579" request.header.accept="application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, applicatio

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci-rootless-slirp4netns-detachnetns, ./client ./cmd/buildctl ./worker/containerd ./solver ....

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless-slirp4netns-detachnetns

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless-slirp4netns-detachnetns === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless-slirp4netns-detachnetns === CONT TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless-slirp4netns-detachnetns build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=oci-rootless-slirp4netns-detachnetns sandbox.go:135: stdout: /usr/bin/sudo -u #1000 -i -- exec rootlesskit --net=slirp4netns --copy-up=/etc --disable-host-loopback --detach-netns buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1358755824/buildkitd.toml --root /tmp/bktest_buildkitd1300237981 --addr unix:///tmp/bktest_buildkitd1300237981/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/sudo -u #1000 -i -- exec rootlesskit --net=slirp4netns --copy-up=/etc --disable-host-loopback --detach-netns buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1358755824/buildkitd.toml --root /tmp/bktest_buildkitd1300237981 --addr unix:///tmp/bktest_buildkitd1300237981/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-28 13:51:29.711841801 +0000 UTC m=+0.080218187 /usr/bin/sudo -u #1000 -i -- exec rootlesskit --net=slirp4netns --copy-up=/etc --disable-host-loopback --detach-netns buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --config=/tmp/bktest_config1358755824/buildkitd.toml --root /tmp/bktest_buildkitd1300237981 --addr unix:///tmp/bktest_buildkitd1300237981/buildkitd.sock --debug sandbox.go:138: warning: GOCOVERDIR not set, no coverage data emitted sandbox.go:138: time="2024-10-28T13:51:30Z" level=info msg="auto snapshotter: using overlayfs" sandbox.go:138: time="2024-10-28T13:51:30Z" level=debug msg="running in rootless mode" sandbox.go:138: time="2024-10-28T13:51:30Z" level=info msg="found worker \"ucfddnwjn61s0s8eunb523xg7\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:9c907146687c org.mobyproject.buildkit.worker.network:host org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:overlayfs], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-28T13:51:30Z" level=info msg="found 1 workers, default=\"ucfddnwjn61s0s8eunb523xg7\"" sandbox.go:138: time="2024-10-28T13:51:30Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-28T13:51:30Z" level=info msg="running server on /tmp/bktest_buildkitd1300237981/buildkitd.sock" sandbox.go:138: time="2024-10-28T13:51:30Z" level=debug msg="resolve exporter image with map[name:example.com/moby/metadata:test push:false]" spanID=e0bd06914e894516 traceID=9cbc174848b2a9f57c54a477eca903b4 sandbox.go:138: time="2024-10-28T13:51:30Z" level=debug msg="session started" spanID=be6b4be3445dfa48 traceID=9cbc174848b2a9f57c54a477eca903b4 sandbox.go:138: time="2024-10-28T13:51:30Z" level=debug msg="checked for cached auth handler namespace" cached=false key="docker.io/library/busybox::pull" name=docker.io/library/busybox scope=pull sandbox.go:138: time="2024-10-28T13:51:30Z" level=debug msg=resolving host="localhost:36241" spanID=e0bd06914e894516 traceID=9cbc174848b

Check failure on line 168 in cmd/buildctl/build_test.go

View workflow job for this annotation

GitHub Actions / test / run (oci-snapshotter-stargz, ./client ./cmd/buildctl ./worker/containerd ./solver ./frontend, int...

Failed: cmd/buildctl/TestCLIIntegration/TestBuildMetadataFile/worker=oci-snapshotter-stargz

=== RUN TestCLIIntegration/TestBuildMetadataFile/worker=oci-snapshotter-stargz === PAUSE TestCLIIntegration/TestBuildMetadataFile/worker=oci-snapshotter-stargz === CONT TestCLIIntegration/TestBuildMetadataFile/worker=oci-snapshotter-stargz build_test.go:168: Error Trace: /src/cmd/buildctl/build_test.go:168 /src/util/testutil/integration/run.go:97 /src/util/testutil/integration/run.go:211 Error: Received unexpected error: json: cannot unmarshal object into Go value of type []*v1.Descriptor Test: TestCLIIntegration/TestBuildMetadataFile/worker=oci-snapshotter-stargz sandbox.go:135: stdout: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker-snapshotter=stargz --config=/tmp/bktest_config3296546478/buildkitd.toml --root /tmp/bktest_buildkitd3981969347 --addr unix:///tmp/bktest_buildkitd3981969347/buildkitd.sock --debug sandbox.go:135: stderr: /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker-snapshotter=stargz --config=/tmp/bktest_config3296546478/buildkitd.toml --root /tmp/bktest_buildkitd3981969347 --addr unix:///tmp/bktest_buildkitd3981969347/buildkitd.sock --debug sandbox.go:138: > StartCmd 2024-10-28 13:51:29.266483865 +0000 UTC m=+0.050277878 /usr/bin/buildkitd --oci-worker=true --containerd-worker=false --oci-worker-gc=false --oci-worker-labels=org.mobyproject.buildkit.worker.sandbox=true --oci-worker-snapshotter=stargz --config=/tmp/bktest_config3296546478/buildkitd.toml --root /tmp/bktest_buildkitd3981969347 --addr unix:///tmp/bktest_buildkitd3981969347/buildkitd.sock --debug sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="could not read \"/tmp/bktest_buildkitd3981969347/net/cni\" for cleanup: open /tmp/bktest_buildkitd3981969347/net/cni: no such file or directory" sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="creating new network namespace fayhgvu01rva25qne89rv5rki" sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="finished creating network namespace fayhgvu01rva25qne89rv5rki" sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="finished setting up network namespace fayhgvu01rva25qne89rv5rki" sandbox.go:138: time="2024-10-28T13:51:29Z" level=info msg="found worker \"sgsk66gem1u8t5a75hg7a7tgn\", labels=map[org.mobyproject.buildkit.worker.executor:oci org.mobyproject.buildkit.worker.hostname:6b53085b2830 org.mobyproject.buildkit.worker.network:cni org.mobyproject.buildkit.worker.oci.process-mode:sandbox org.mobyproject.buildkit.worker.sandbox:true org.mobyproject.buildkit.worker.selinux.enabled:false org.mobyproject.buildkit.worker.snapshotter:stargz], platforms=[linux/amd64 linux/amd64/v2 linux/amd64/v3 linux/arm64 linux/riscv64 linux/ppc64le linux/s390x linux/386 linux/arm/v7 linux/arm/v6]" sandbox.go:138: time="2024-10-28T13:51:29Z" level=info msg="found 1 workers, default=\"sgsk66gem1u8t5a75hg7a7tgn\"" sandbox.go:138: time="2024-10-28T13:51:29Z" level=warning msg="currently, only the default worker can be used." sandbox.go:138: time="2024-10-28T13:51:29Z" level=info msg="running server on /tmp/bktest_buildkitd3981969347/buildkitd.sock" sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="resolve exporter image with map[name:example.com/moby/metadata:test push:false]" spanID=6f3db3fe4f187222 traceID=2e08d74ae7f7330062ed30e15951d487 sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="session started" spanID=a369353b3f82e777 traceID=2e08d74ae7f7330062ed30e15951d487 sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg="checked for cached auth handler namespace" cached=false key="docker.io/library/busybox::pull" name=docker.io/library/busybox scope=pull sandbox.go:138: time="2024-10-28T13:51:29Z" level=debug msg=resolving host="localhost:41351" spanID=

cdAddress := sb.ContainerdAddress()
if cdAddress == "" {
t.Log("no containerd worker, skipping digest verification")
Expand Down
9 changes: 8 additions & 1 deletion exporter/containerimage/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,11 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source
}
}()

desc, err := e.opt.ImageWriter.Commit(ctx, src, sessionID, inlineCache, &opts)
descriptors, err := e.opt.ImageWriter.Commit(ctx, src, sessionID, inlineCache, &opts)
if err != nil {
return nil, nil, err
}
desc := descriptors[0]
defer func() {
if err == nil {
descref = NewDescriptorReference(*desc, done)
Expand Down Expand Up @@ -359,6 +360,12 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source
}
resp[exptypes.ExporterImageDescriptorKey] = base64.StdEncoding.EncodeToString(dtdesc)

dtdesclist, err := json.Marshal(map[string]any{"list": descriptors})
if err != nil {
return nil, nil, err
}
resp[exptypes.ExporterImageDescriptorsKey] = base64.StdEncoding.EncodeToString(dtdesclist)

return resp, nil, nil
}

Expand Down
1 change: 1 addition & 0 deletions exporter/containerimage/exptypes/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
ExporterImageConfigKey = "containerimage.config"
ExporterImageConfigDigestKey = "containerimage.config.digest"
ExporterImageDescriptorKey = "containerimage.descriptor"
ExporterImageDescriptorsKey = "containerimage.descriptors"
ExporterImageBaseConfigKey = "containerimage.base.config"
ExporterPlatformsKey = "refs.platforms"
)
Expand Down
25 changes: 16 additions & 9 deletions exporter/containerimage/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ImageWriter struct {
opt WriterOpt
}

func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, sessionID string, inlineCache exptypes.InlineCache, opts *ImageCommitOpts) (*ocispecs.Descriptor, error) {
func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, sessionID string, inlineCache exptypes.InlineCache, opts *ImageCommitOpts) ([]*ocispecs.Descriptor, error) {
if _, ok := inp.Metadata[exptypes.ExporterPlatformsKey]; len(inp.Refs) > 0 && !ok {
return nil, errors.Errorf("unable to export multiple refs, missing platforms mapping")
}
Expand Down Expand Up @@ -180,7 +180,10 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
}
mfstDesc.Annotations[exptypes.ExporterConfigDigestKey] = configDesc.Digest.String()

return mfstDesc, nil
return []*ocispecs.Descriptor{
mfstDesc,
configDesc,
}, nil
}

if len(inp.Attestations) > 0 {
Expand Down Expand Up @@ -225,6 +228,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session

labels := map[string]string{}

var descriptors []*ocispecs.Descriptor
var attestationManifests []ocispecs.Descriptor

for i, p := range ps.Platforms {
Expand Down Expand Up @@ -261,15 +265,16 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
inlineCacheEntry, _ = inlineCacheResult.FindRef(p.ID)
}

desc, _, err := ic.commitDistributionManifest(ctx, opts, r, config, remote, opts.Annotations.Platform(&p.Platform), inlineCacheEntry, opts.Epoch, session.NewGroup(sessionID), baseImg)
mfstDesc, configDesc, err := ic.commitDistributionManifest(ctx, opts, r, config, remote, opts.Annotations.Platform(&p.Platform), inlineCacheEntry, opts.Epoch, session.NewGroup(sessionID), baseImg)
if err != nil {
return nil, err
}
dp := p.Platform
desc.Platform = &dp
idx.Manifests = append(idx.Manifests, *desc)
mfstDesc.Platform = &dp
idx.Manifests = append(idx.Manifests, *mfstDesc)
descriptors = append(descriptors, mfstDesc, configDesc)

labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i)] = desc.Digest.String()
labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", i)] = mfstDesc.Digest.String()

if attestations, ok := inp.Attestations[p.ID]; ok {
attestations, err := attestation.Unbundle(ctx, session.NewGroup(sessionID), attestations)
Expand Down Expand Up @@ -304,15 +309,15 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
}
defaultSubjects = append(defaultSubjects, intoto.Subject{
Name: pl,
Digest: result.ToDigestMap(desc.Digest),
Digest: result.ToDigestMap(mfstDesc.Digest),
})
}
stmts, err := attestation.MakeInTotoStatements(ctx, session.NewGroup(sessionID), attestations, defaultSubjects)
if err != nil {
return nil, err
}

desc, err := ic.commitAttestationsManifest(ctx, opts, desc.Digest.String(), stmts)
desc, err := ic.commitAttestationsManifest(ctx, opts, mfstDesc.Digest.String(), stmts)
if err != nil {
return nil, err
}
Expand All @@ -323,6 +328,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session

for i, mfst := range attestationManifests {
idx.Manifests = append(idx.Manifests, mfst)
descriptors = append(descriptors, &mfst)
labels[fmt.Sprintf("containerd.io/gc.ref.content.%d", len(ps.Platforms)+i)] = mfst.Digest.String()
}

Expand All @@ -344,8 +350,9 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp *exporter.Source, session
return nil, idxDone(errors.Wrapf(err, "error writing manifest list blob %s", idxDigest))
}
idxDone(nil)
descriptors = append([]*ocispecs.Descriptor{&idxDesc}, descriptors...)

return &idxDesc, nil
return descriptors, nil
}

func (ic *ImageWriter) exportLayers(ctx context.Context, refCfg cacheconfig.RefConfig, s session.Group, refs ...cache.ImmutableRef) ([]solver.Remote, error) {
Expand Down
9 changes: 8 additions & 1 deletion exporter/oci/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source
}
}()

desc, err := e.opt.ImageWriter.Commit(ctx, src, sessionID, inlineCache, &opts)
descriptors, err := e.opt.ImageWriter.Commit(ctx, src, sessionID, inlineCache, &opts)
if err != nil {
return nil, nil, err
}
desc := descriptors[0]
defer func() {
if err == nil {
descref = containerimage.NewDescriptorReference(*desc, done)
Expand Down Expand Up @@ -194,6 +195,12 @@ func (e *imageExporterInstance) Export(ctx context.Context, src *exporter.Source
}
resp[exptypes.ExporterImageDescriptorKey] = base64.StdEncoding.EncodeToString(dtdesc)

dtdesclist, err := json.Marshal(map[string]any{"list": descriptors})
if err != nil {
return nil, nil, err
}
resp[exptypes.ExporterImageDescriptorsKey] = base64.StdEncoding.EncodeToString(dtdesclist)

if n, ok := src.Metadata["image.name"]; e.opts.ImageName == "*" && ok {
e.opts.ImageName = string(n)
}
Expand Down

0 comments on commit 24317a6

Please sign in to comment.