Exporter config digest typo
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>v0.9
parent
66d30551db
commit
f4a67d7e9c
|
@ -31,6 +31,7 @@ import (
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
"github.com/containerd/continuity/fs/fstest"
|
"github.com/containerd/continuity/fs/fstest"
|
||||||
"github.com/moby/buildkit/client/llb"
|
"github.com/moby/buildkit/client/llb"
|
||||||
|
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||||
gateway "github.com/moby/buildkit/frontend/gateway/client"
|
gateway "github.com/moby/buildkit/frontend/gateway/client"
|
||||||
"github.com/moby/buildkit/identity"
|
"github.com/moby/buildkit/identity"
|
||||||
"github.com/moby/buildkit/session"
|
"github.com/moby/buildkit/session"
|
||||||
|
@ -591,10 +592,10 @@ func testPushByDigest(t *testing.T, sb integration.Sandbox) {
|
||||||
_, _, err = contentutil.ProviderFromRef(name + ":latest")
|
_, _, err = contentutil.ProviderFromRef(name + ":latest")
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
|
|
||||||
desc, _, err := contentutil.ProviderFromRef(name + "@" + resp.ExporterResponse["containerimage.digest"])
|
desc, _, err := contentutil.ProviderFromRef(name + "@" + resp.ExporterResponse[exptypes.ExporterImageDigestKey])
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
require.Equal(t, resp.ExporterResponse["containerimage.digest"], desc.Digest.String())
|
require.Equal(t, resp.ExporterResponse[exptypes.ExporterImageDigestKey], desc.Digest.String())
|
||||||
require.Equal(t, images.MediaTypeDockerSchema2Manifest, desc.MediaType)
|
require.Equal(t, images.MediaTypeDockerSchema2Manifest, desc.MediaType)
|
||||||
require.True(t, desc.Size > 0)
|
require.True(t, desc.Size > 0)
|
||||||
}
|
}
|
||||||
|
@ -1861,19 +1862,19 @@ func testExporterTargetExists(t *testing.T, sb integration.Sandbox) {
|
||||||
Type: ExporterOCI,
|
Type: ExporterOCI,
|
||||||
Attrs: map[string]string{},
|
Attrs: map[string]string{},
|
||||||
Output: func(m map[string]string) (io.WriteCloser, error) {
|
Output: func(m map[string]string) (io.WriteCloser, error) {
|
||||||
mdDgst = m["containerimage.digest"]
|
mdDgst = m[exptypes.ExporterImageDigestKey]
|
||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
dgst := res.ExporterResponse["containerimage.digest"]
|
dgst := res.ExporterResponse[exptypes.ExporterImageDigestKey]
|
||||||
|
|
||||||
require.True(t, strings.HasPrefix(dgst, "sha256:"))
|
require.True(t, strings.HasPrefix(dgst, "sha256:"))
|
||||||
require.Equal(t, dgst, mdDgst)
|
require.Equal(t, dgst, mdDgst)
|
||||||
|
|
||||||
require.True(t, strings.HasPrefix(res.ExporterResponse["containerimage.config.digest"], "sha256:"))
|
require.True(t, strings.HasPrefix(res.ExporterResponse[exptypes.ExporterImageConfigDigestKey], "sha256:"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTarExporterWithSocket(t *testing.T, sb integration.Sandbox) {
|
func testTarExporterWithSocket(t *testing.T, sb integration.Sandbox) {
|
||||||
|
@ -2792,7 +2793,7 @@ func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
dgst, ok := resp.ExporterResponse["containerimage.digest"]
|
dgst, ok := resp.ExporterResponse[exptypes.ExporterImageDigestKey]
|
||||||
require.Equal(t, ok, true)
|
require.Equal(t, ok, true)
|
||||||
|
|
||||||
unique, err := readFileInImage(sb.Context(), c, target+"@"+dgst, "/unique")
|
unique, err := readFileInImage(sb.Context(), c, target+"@"+dgst, "/unique")
|
||||||
|
@ -2831,7 +2832,7 @@ func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
dgst2, ok := resp.ExporterResponse["containerimage.digest"]
|
dgst2, ok := resp.ExporterResponse[exptypes.ExporterImageDigestKey]
|
||||||
require.Equal(t, ok, true)
|
require.Equal(t, ok, true)
|
||||||
|
|
||||||
require.Equal(t, dgst, dgst2)
|
require.Equal(t, dgst, dgst2)
|
||||||
|
@ -2862,7 +2863,7 @@ func testBasicInlineCacheImportExport(t *testing.T, sb integration.Sandbox) {
|
||||||
}, nil)
|
}, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
dgst3, ok := resp.ExporterResponse["containerimage.digest"]
|
dgst3, ok := resp.ExporterResponse[exptypes.ExporterImageDigestKey]
|
||||||
require.Equal(t, ok, true)
|
require.Equal(t, ok, true)
|
||||||
|
|
||||||
// dgst3 != dgst, because inline cache is not exported for dgst3
|
// dgst3 != dgst, because inline cache is not exported for dgst3
|
||||||
|
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"github.com/containerd/continuity/fs/fstest"
|
"github.com/containerd/continuity/fs/fstest"
|
||||||
"github.com/moby/buildkit/client/llb"
|
"github.com/moby/buildkit/client/llb"
|
||||||
|
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||||
"github.com/moby/buildkit/util/testutil/integration"
|
"github.com/moby/buildkit/util/testutil/integration"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
@ -147,7 +148,7 @@ func testBuildMetadataFile(t *testing.T, sb integration.Sandbox) {
|
||||||
|
|
||||||
require.Equal(t, imageName, metadata["image.name"])
|
require.Equal(t, imageName, metadata["image.name"])
|
||||||
|
|
||||||
digest := metadata["containerimage.digest"]
|
digest := metadata[exptypes.ExporterImageDigestKey]
|
||||||
require.NotEmpty(t, digest)
|
require.NotEmpty(t, digest)
|
||||||
|
|
||||||
cdAddress := sb.ContainerdAddress()
|
cdAddress := sb.ContainerdAddress()
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/containerd/containerd/rootfs"
|
"github.com/containerd/containerd/rootfs"
|
||||||
"github.com/moby/buildkit/cache"
|
"github.com/moby/buildkit/cache"
|
||||||
"github.com/moby/buildkit/exporter"
|
"github.com/moby/buildkit/exporter"
|
||||||
|
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||||
"github.com/moby/buildkit/session"
|
"github.com/moby/buildkit/session"
|
||||||
"github.com/moby/buildkit/snapshot"
|
"github.com/moby/buildkit/snapshot"
|
||||||
"github.com/moby/buildkit/util/compression"
|
"github.com/moby/buildkit/util/compression"
|
||||||
|
@ -284,9 +285,9 @@ func (e *imageExporterInstance) Export(ctx context.Context, src exporter.Source,
|
||||||
resp["image.name"] = e.targetName
|
resp["image.name"] = e.targetName
|
||||||
}
|
}
|
||||||
|
|
||||||
resp["containerimage.digest"] = desc.Digest.String()
|
resp[exptypes.ExporterImageDigestKey] = desc.Digest.String()
|
||||||
if v, ok := desc.Annotations["config.digest"]; ok {
|
if v, ok := desc.Annotations[exptypes.ExporterConfigDigestKey]; ok {
|
||||||
resp["containerimage.config.digest"] = v
|
resp[exptypes.ExporterImageConfigDigestKey] = v
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,14 @@ import (
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ExporterImageConfigKey = "containerimage.config"
|
const (
|
||||||
const ExporterInlineCache = "containerimage.inlinecache"
|
ExporterConfigDigestKey = "config.digest"
|
||||||
const ExporterPlatformsKey = "refs.platforms"
|
ExporterImageDigestKey = "containerimage.digest"
|
||||||
|
ExporterImageConfigKey = "containerimage.config"
|
||||||
|
ExporterImageConfigDigestKey = "containerimage.config.digest"
|
||||||
|
ExporterInlineCache = "containerimage.inlinecache"
|
||||||
|
ExporterPlatformsKey = "refs.platforms"
|
||||||
|
)
|
||||||
|
|
||||||
const EmptyGZLayer = digest.Digest("sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1")
|
const EmptyGZLayer = digest.Digest("sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1")
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (ic *ImageWriter) Commit(ctx context.Context, inp exporter.Source, oci bool
|
||||||
if mfstDesc.Annotations == nil {
|
if mfstDesc.Annotations == nil {
|
||||||
mfstDesc.Annotations = make(map[string]string)
|
mfstDesc.Annotations = make(map[string]string)
|
||||||
}
|
}
|
||||||
mfstDesc.Annotations["config.digest"] = configDesc.Digest.String()
|
mfstDesc.Annotations[exptypes.ExporterConfigDigestKey] = configDesc.Digest.String()
|
||||||
return mfstDesc, nil
|
return mfstDesc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/moby/buildkit/cache"
|
"github.com/moby/buildkit/cache"
|
||||||
"github.com/moby/buildkit/exporter"
|
"github.com/moby/buildkit/exporter"
|
||||||
"github.com/moby/buildkit/exporter/containerimage"
|
"github.com/moby/buildkit/exporter/containerimage"
|
||||||
|
"github.com/moby/buildkit/exporter/containerimage/exptypes"
|
||||||
"github.com/moby/buildkit/session"
|
"github.com/moby/buildkit/session"
|
||||||
"github.com/moby/buildkit/session/filesync"
|
"github.com/moby/buildkit/session/filesync"
|
||||||
"github.com/moby/buildkit/util/compression"
|
"github.com/moby/buildkit/util/compression"
|
||||||
|
@ -150,10 +151,10 @@ func (e *imageExporterInstance) Export(ctx context.Context, src exporter.Source,
|
||||||
desc.Annotations[ocispec.AnnotationCreated] = time.Now().UTC().Format(time.RFC3339)
|
desc.Annotations[ocispec.AnnotationCreated] = time.Now().UTC().Format(time.RFC3339)
|
||||||
|
|
||||||
resp := make(map[string]string)
|
resp := make(map[string]string)
|
||||||
resp["containerimage.digest"] = desc.Digest.String()
|
resp[exptypes.ExporterImageDigestKey] = desc.Digest.String()
|
||||||
if v, ok := desc.Annotations["config.digest"]; ok {
|
if v, ok := desc.Annotations[exptypes.ExporterConfigDigestKey]; ok {
|
||||||
resp["containerimage.config.digest"] = v
|
resp[exptypes.ExporterImageConfigDigestKey] = v
|
||||||
delete(desc.Annotations, "config.digeest")
|
delete(desc.Annotations, exptypes.ExporterConfigDigestKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
if n, ok := src.Metadata["image.name"]; e.name == "*" && ok {
|
if n, ok := src.Metadata["image.name"]; e.name == "*" && ok {
|
||||||
|
|
Loading…
Reference in New Issue