From 3d88c1443f709b0bb453e8cd7e814c4b807d079e Mon Sep 17 00:00:00 2001 From: Samuel O'Neal Date: Sat, 30 May 2026 12:09:33 -0600 Subject: [PATCH] added log message if image is considered not buildable --- provider/internal/image.go | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/provider/internal/image.go b/provider/internal/image.go index e6687e4..b92dcff 100644 --- a/provider/internal/image.go +++ b/provider/internal/image.go @@ -68,7 +68,8 @@ type Image struct { // Annotate provides a description of the Image resource. func (i *Image) Annotate(a infer.Annotator) { - a.Describe(&i, dedent(` + a.Describe( + &i, dedent(` A Docker image built using buildx -- Docker's interface to the improved BuildKit backend. @@ -79,8 +80,8 @@ func (i *Image) Annotate(a infer.Annotator) { We will strive to keep APIs and behavior as stable as possible, but we cannot guarantee stability until version 1.0. `)+ - "\n\n"+_migration+ - "\n\n"+_imageExamples, + "\n\n"+_migration+ + "\n\n"+_imageExamples, ) } @@ -302,7 +303,8 @@ type ImageState struct { func (is *ImageState) Annotate(a infer.Annotator) { is.ImageArgs.Annotate(a) - a.Describe(&is.Digest, dedent(` + a.Describe(&is.Digest, dedent( + ` A SHA256 digest of the image if it was exported to a registry or elsewhere. @@ -434,7 +436,13 @@ func (ia *ImageArgs) normalize(preview bool) ImageArgs { func (ia *ImageArgs) buildable() bool { // We can build the given inputs if filtering unknowns is a no-op. filtered := ia.normalize(true) - return reflect.DeepEqual(ia, &filtered) + equal := reflect.DeepEqual(ia, &filtered) + + if !equal { + fmt.Printf("Not buildable:\n\tArgs => %v\n\tNormalize => %v", ia, &filtered) + } + + return equal } // isExported returns true if the args include a registry export. @@ -499,13 +507,15 @@ func (ia ImageArgs) toBuild( if len(ia.Exports) == 0 && !ia.Push && !ia.Load { provider.GetLogger(ctx).Warning( "No exports were specified so the build will only remain in the local build cache. " + - "Use `push` to upload the image to a registry, or silence this warning with a `cacheonly` export.") + "Use `push` to upload the image to a registry, or silence this warning with a `cacheonly` export.", + ) } if len(opts.Platforms) > 1 && len(opts.CacheTo) > 0 { provider.GetLogger(ctx).Warning( "Caching doesn't work reliably with multi-platform builds (https://github.com/docker/buildx/discussions/1382). " + - "Instead, perform one cached build per platform and create an Index to join them all together.") + "Instead, perform one cached build per platform and create an Index to join them all together.", + ) } return &build{ @@ -523,7 +533,8 @@ func (ia *ImageArgs) validate(supportsMultipleExports, preview bool) (controller if !supportsMultipleExports { if len(ia.Exports) > 1 { - multierr = errors.Join(multierr, + multierr = errors.Join( + multierr, newCheckFailure(errors.New("multiple exports require a v0.13 buildkit daemon or newer"), "exports"), ) } @@ -537,7 +548,8 @@ func (ia *ImageArgs) validate(supportsMultipleExports, preview bool) (controller ) } if len(ia.Exports) > 0 && (ia.Push || ia.Load) { - multierr = errors.Join(multierr, + multierr = errors.Join( + multierr, newCheckFailure(errors.New("multiple exports require a v0.13 buildkit daemon or newer"), "exports"), ) } @@ -778,7 +790,8 @@ func (i *Image) Update( ctx context.Context, req infer.UpdateRequest[ImageArgs, ImageState], ) (infer.UpdateResponse[ImageState], error) { - resp, err := i.Create(ctx, + resp, err := i.Create( + ctx, infer.CreateRequest[ImageArgs]{Name: req.ID, Inputs: req.Inputs, DryRun: req.DryRun}, ) return infer.UpdateResponse[ImageState]{Output: resp.Output}, err