Skip to content

imagetools: metadata-file flag#3638

Open
crazy-max wants to merge 1 commit intodocker:masterfrom
crazy-max:imagetools-create-digest
Open

imagetools: metadata-file flag#3638
crazy-max wants to merge 1 commit intodocker:masterfrom
crazy-max:imagetools-create-digest

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Feb 3, 2026

In the Docker GitHub Builder workflows we are merging manifests with the imagetools create command. This command doesn't output the pushed digest while build or bake commands do it.

This PR add a metadata-file flag similar to build and bake commands.

This will be necessary in our github builder so we can have an output for this digest that can then be used in subsequent jobs.

thaJeztah
thaJeztah previously approved these changes Feb 3, 2026
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@thaJeztah
Copy link
Member

Oh! Tests are failing though, and could be related?

=== Failed
=== FAIL: tests TestIntegration/TestImagetoolsCopyIndex/worker=docker-container (1.64s)
    imagetools.go:148: 
        	Error Trace:	/src/tests/imagetools.go:148
        	            				/src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:103
        	            				/src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:251
        	Error:      	Received unexpected error:
        	            	invalid checksum digest length
        	Test:       	TestIntegration/TestImagetoolsCopyIndex/worker=docker-container
    --- FAIL: TestIntegration/TestImagetoolsCopyIndex/worker=docker-container (1.64s)

=== FAIL: tests TestIntegration/TestImagetoolsCopyManifest/worker=docker-container (1.87s)
    imagetools.go:63: 
        	Error Trace:	/src/tests/imagetools.go:63
        	            				/src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:103
        	            				/src/vendor/github.com/moby/buildkit/util/testutil/integration/run.go:251
        	Error:      	Received unexpected error:
        	            	invalid checksum digest length
        	Test:       	TestIntegration/TestImagetoolsCopyManifest/worker=docker-container
    --- FAIL: TestIntegration/TestImagetoolsCopyManifest/worker=docker-container (1.87s)

@crazy-max crazy-max force-pushed the imagetools-create-digest branch from 6c3c4c7 to f5568d2 Compare February 3, 2026 15:53
@crazy-max crazy-max added this to the v0.32.0 milestone Feb 3, 2026
Comment on lines 101 to 103
t.Logf("digest: %s", outputDigest)
_, err = digest.Parse(outputDigest)
require.NoError(t, err)
Copy link
Member

@thaJeztah thaJeztah Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the t.Logf for debugging? (I always try to avoid logs in tests, and instead only log on failure; e.g.;

Suggested change
t.Logf("digest: %s", outputDigest)
_, err = digest.Parse(outputDigest)
require.NoError(t, err)
_, err = digest.Parse(outputDigest)
require.NoError(t, err, "digest: %s", outputDigest)

@tonistiigi
Copy link
Member

I think I prefer --metadata-file so that we can extend it if more fields are needed in the future.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max crazy-max force-pushed the imagetools-create-digest branch from f5568d2 to 1db71a1 Compare February 3, 2026 16:54
@crazy-max crazy-max changed the title imagetools: output pushed digest to stdout imagetools: metadata-file flag Feb 3, 2026
@crazy-max
Copy link
Member Author

I think I prefer --metadata-file so that we can extend it if more fields are needed in the future.

Should be good now


if err == nil && len(in.metadataFile) > 0 {
if err := writeMetadataFile(in.metadataFile, map[string]any{
exptypes.ExporterImageDigestKey: desc.Digest.String(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe already better to just add ExporterImageDescriptorKey ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants