Skip to content

Commit a090dbb

Browse files
pkglib: untangle WithBuildDocker and DryRun
this makes it possible for a user of this API to build their own DryRunner Signed-off-by: Christoph Ostarek <christoph@zededa.com>
1 parent 32b189b commit a090dbb

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/cmd/linuxkit/pkg_build.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ func pkgBuildCmd() *cobra.Command {
115115

116116
if dryRun {
117117
opts = append(opts, pkglib.WithDryRun())
118+
opts = append(opts, pkglib.WithBuildDocker(pkglib.NewDockerDryRunner()))
119+
118120
}
119121

120122
// read any build arg files

src/cmd/linuxkit/pkglib/build.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,7 @@ func (p Pkg) Build(bos ...BuildOpt) error {
318318
}
319319

320320
d := bo.runner
321-
switch {
322-
case bo.dryRun:
323-
d = newDockerDryRunner()
324-
case d == nil:
321+
if d == nil {
325322
d = newDockerRunner(p.cache)
326323
}
327324

src/cmd/linuxkit/pkglib/dockerdryrun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
type dockerDryRunnerImpl struct {
2626
}
2727

28-
func newDockerDryRunner() DockerRunner {
28+
func NewDockerDryRunner() DockerRunner {
2929
return &dockerDryRunnerImpl{}
3030
}
3131

0 commit comments

Comments
 (0)