Skip to content

Commit e604b15

Browse files
committed
targets/linux/deb/distro/container.go: don't check for empty default output image
It is not user configurable, so if that condition occurs, it's a bug in dalec target specificiation, so we expect tests to fail and catch that. Also this code will not be relevant once we switch to minimal images. Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
1 parent 2e2172d commit e604b15

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

targets/linux/deb/distro/container.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package distro
22

33
import (
44
"context"
5-
"fmt"
65

76
"github.com/moby/buildkit/client/llb"
87
gwclient "github.com/moby/buildkit/frontend/gateway/client"
@@ -12,26 +11,19 @@ import (
1211
)
1312

1413
func (c *Config) BuildContainer(ctx context.Context, client gwclient.Client, sOpt dalec.SourceOpts, spec *dalec.Spec, targetKey string, debSt llb.State, opts ...llb.ConstraintsOpt) llb.State {
14+
opts = append(opts, frontend.IgnoreCache(client), dalec.ProgressGroup("Build Container Image"))
15+
16+
baseImg := llb.Image(c.DefaultOutputImage, llb.WithMetaResolver(sOpt.Resolver), dalec.WithConstraints(opts...))
17+
1518
bi, err := spec.GetSingleBase(targetKey)
1619
if err != nil {
1720
return dalec.ErrorState(llb.Scratch(), err)
1821
}
1922

20-
opts = append(opts, frontend.IgnoreCache(client))
21-
22-
var baseImg llb.State
2323
if bi != nil {
24-
img := bi.ToState(sOpt, opts...)
25-
baseImg = img
26-
} else {
27-
if c.DefaultOutputImage == "" {
28-
return dalec.ErrorState(llb.Scratch(), fmt.Errorf("no output image ref specified, cannot build from scratch"))
29-
}
30-
baseImg = llb.Image(c.DefaultOutputImage, llb.WithMetaResolver(sOpt.Resolver), dalec.WithConstraints(opts...))
24+
baseImg = bi.ToState(sOpt, opts...)
3125
}
3226

33-
opts = append(opts, dalec.ProgressGroup("Build Container Image"))
34-
3527
repos := dalec.GetExtraRepos(c.ExtraRepos, "install")
3628
repos = append(repos, spec.GetInstallRepos(targetKey)...)
3729

0 commit comments

Comments
 (0)