This commit is contained in:
Bryce Lampe
2025-04-28 14:32:06 -07:00
parent d98d613dd6
commit f58b786284

View File

@@ -519,9 +519,7 @@ func (ia ImageArgs) toBuild(
// validate confirms the ImageArgs are valid and returns BuildOptions // validate confirms the ImageArgs are valid and returns BuildOptions
// appropriate for passing to builders. // appropriate for passing to builders.
func (ia *ImageArgs) validate( func (ia *ImageArgs) validate(supportsMultipleExports, preview bool) (controllerapi.BuildOptions, error) {
supportsMultipleExports, preview bool,
) (controllerapi.BuildOptions, error) {
var multierr error var multierr error
if !supportsMultipleExports { if !supportsMultipleExports {
@@ -529,6 +527,7 @@ func (ia *ImageArgs) validate(
multierr = errors.Join(multierr, multierr = errors.Join(multierr,
newCheckFailure(errors.New("multiple exports require a v0.13 buildkit daemon or newer"), "exports"), newCheckFailure(errors.New("multiple exports require a v0.13 buildkit daemon or newer"), "exports"),
) )
}
if ia.Push && ia.Load { if ia.Push && ia.Load {
multierr = errors.Join( multierr = errors.Join(
multierr, multierr,
@@ -703,23 +702,23 @@ func (i *Image) Create(
ok, err := cli.BuildKitEnabled() ok, err := cli.BuildKitEnabled()
if err != nil { if err != nil {
return infer.CreateResponse[ImageState]{ return infer.CreateResponse[ImageState]{
ID: id, ID: id,
Output: state, Output: state,
}, fmt.Errorf("checking buildkit compatibility: %w", err) }, fmt.Errorf("checking buildkit compatibility: %w", err)
} }
if !ok { if !ok {
return infer.CreateResponse[ImageState]{ return infer.CreateResponse[ImageState]{
ID: id, ID: id,
Output: state, Output: state,
}, fmt.Errorf("buildkit is not supported on this host") }, errors.New("buildkit is not supported on this host")
} }
build, err := input.toBuild(ctx, cli.SupportsMultipleExports(), req.Preview) build, err := input.toBuild(ctx, cli.SupportsMultipleExports(), req.Preview)
if err != nil { if err != nil {
return infer.CreateResponse[ImageState]{ return infer.CreateResponse[ImageState]{
ID: id, ID: id,
Output: state, Output: state,
}, fmt.Errorf("preparing: %w", err) }, fmt.Errorf("preparing: %w", err)
} }
hash, err := hashBuildContext( hash, err := hashBuildContext(
@@ -729,9 +728,9 @@ func (i *Image) Create(
) )
if err != nil { if err != nil {
return infer.CreateResponse[ImageState]{ return infer.CreateResponse[ImageState]{
ID: id, ID: id,
Output: state, Output: state,
}, fmt.Errorf("hashing build context: %w", err) }, fmt.Errorf("hashing build context: %w", err)
} }
state.ContextHash = hash state.ContextHash = hash