Skip to content

Commit 20bf902

Browse files
authored
Return err if locking fails (#1464)
Missed this return in a refactor. Fixes #1448 Signed-off-by: Jon Johnson <[email protected]>
1 parent beab68c commit 20bf902

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

internal/cli/build.go

+5-9
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ func buildImageComponents(ctx context.Context, workDir string, archs []types.Arc
189189
return nil, nil, err
190190
}
191191

192+
if ic.Contents.BaseImage != nil && o.Lockfile == "" {
193+
return nil, nil, fmt.Errorf("building with base image is supported only with a lockfile")
194+
}
195+
192196
// cases:
193197
// - archs set: use those archs
194198
// - archs not set, bc.ImageConfiguration.Archs set: use Config archs
@@ -202,7 +206,6 @@ func buildImageComponents(ctx context.Context, workDir string, archs []types.Arc
202206
ic.Archs = types.AllArchs
203207
}
204208
// save the final set we will build
205-
archs = ic.Archs
206209
log.Infof("Building images for %d architectures: %+v", len(ic.Archs), ic.Archs)
207210

208211
// Probe the VCS URL if it is not set and we are asked to do so.
@@ -239,15 +242,8 @@ func buildImageComponents(ctx context.Context, workDir string, archs []types.Arc
239242
multiArchBDE := o.SourceDateEpoch
240243

241244
configs, _, err := build.LockImageConfiguration(ctx, *ic, opts...)
242-
mc, err := build.NewMultiArch(ctx, archs, opts...)
243245
if err != nil {
244-
return nil, nil, err
245-
}
246-
247-
for _, bc := range mc.Contexts {
248-
if bc.ImageConfiguration().Contents.BaseImage != nil && o.Lockfile == "" {
249-
return nil, nil, fmt.Errorf("building with base image is supported only with a lockfile")
250-
}
246+
return nil, nil, fmt.Errorf("locking config: %w", err)
251247
}
252248

253249
for arch, ic := range configs {

0 commit comments

Comments
 (0)