Merge pull request #3952 from vvoland/fix-iidfile

build: Fix iidfile for containerd-backed Docker driver
This commit is contained in:
CrazyMax
2026-07-15 16:54:09 +02:00
committed by GitHub
5 changed files with 22 additions and 9 deletions
+4
View File
@@ -491,6 +491,10 @@ func toSolveOpt(ctx context.Context, np *noderesolver.ResolvedNode, multiDriver
}
if e.Type == "image" && nodeDriver.IsMobyDriver() {
opt.Exports[i].Type = "moby"
// The containerd image store resolves images by manifest or index digest.
if nodeDriver.Features(ctx)[driver.PreferImageDigest] {
opt.Exports[i].Attrs["prefer-image-digest"] = "true"
}
if e.Attrs["push"] != "" {
if ok, _ := strconv.ParseBool(e.Attrs["push"]); ok {
if ok, _ := strconv.ParseBool(e.Attrs["push-by-digest"]); ok {
+1 -1
View File
@@ -463,7 +463,7 @@ func runBuild(ctx context.Context, dockerCli command.Cli, debugOpts debuggerOpti
return nil
}
// getImageID returns the image ID - the digest of the image config
// getImageID returns the image identifier selected for the export destination.
func getImageID(resp map[string]string) string {
dgst := resp[exptypes.ExporterImageDigestKey]
if v, ok := resp[exptypes.ExporterImageConfigDigestKey]; ok {
+1
View File
@@ -97,6 +97,7 @@ func (d *Driver) Features(ctx context.Context) map[driver.Feature]bool {
driver.CacheExport: useContainerdSnapshotter,
driver.MultiPlatform: useContainerdSnapshotter,
driver.DirectPush: useContainerdSnapshotter,
driver.PreferImageDigest: useContainerdSnapshotter,
driver.DefaultLoad: true,
}
})
+1
View File
@@ -8,5 +8,6 @@ const DockerExporter Feature = "Docker exporter"
const CacheExport Feature = "Cache export"
const MultiPlatform Feature = "Multi-platform build"
const DirectPush Feature = "Direct push"
const PreferImageDigest Feature = "Prefer image digest"
const DefaultLoad Feature = "Automatically load images to the Docker Engine image store"
+9 -2
View File
@@ -682,12 +682,19 @@ func testImageIDOutput(t *testing.T, sb integration.Sandbox) {
err = json.Unmarshal(dt, &md)
require.NoError(t, err)
require.NotEmpty(t, md.ConfigDigest)
require.NotEmpty(t, md.Digest)
if !isMobyContainerdSnapWorker(sb) {
require.NotEmpty(t, md.ConfigDigest)
}
// verify the image ID output is correct
// XXX: improve this by checking that it's one of the two expected digests depending on the scenario.
require.Contains(t, []digest.Digest{digest.Digest(md.ConfigDigest), digest.Digest(md.Digest)}, dgst)
if sb.DockerAddress() != "" {
cmd = dockerCmd(sb, withArgs("image", "inspect", imageID))
out, err := cmd.CombinedOutput()
require.NoError(t, err, string(out))
}
}
func testBuildMobyFromLocalImage(t *testing.T, sb integration.Sandbox) {