pkglib: untangle WithBuildDocker and DryRun

this makes it possible for a user of this API to
build their own DryRunner

also make newDockerRunner public as well to be consistent

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
This commit is contained in:
Christoph Ostarek
2025-09-12 14:35:53 +02:00
committed by Avi Deitcher
parent bb0cf49975
commit a1cfc53d3c
4 changed files with 6 additions and 6 deletions

View File

@@ -319,10 +319,10 @@ func (p Pkg) Build(bos ...BuildOpt) error {
d := bo.runner
switch {
case bo.dryRun:
d = newDockerDryRunner()
case d == nil && bo.dryRun:
d = NewDockerDryRunner()
case d == nil:
d = newDockerRunner(p.cache)
d = NewDockerRunner(p.cache)
}
c := bo.cacheProvider

View File

@@ -25,7 +25,7 @@ import (
type dockerDryRunnerImpl struct {
}
func newDockerDryRunner() DockerRunner {
func NewDockerDryRunner() DockerRunner {
return &dockerDryRunnerImpl{}
}

View File

@@ -71,7 +71,7 @@ type dockerRunnerImpl struct {
cache bool
}
func newDockerRunner(cache bool) DockerRunner {
func NewDockerRunner(cache bool) DockerRunner {
return &dockerRunnerImpl{cache: cache}
}

View File

@@ -98,7 +98,7 @@ func getClientForPlatform(ctx context.Context, buildersMap map[string]string, bu
if err != nil {
return nil, fmt.Errorf("failed to parse platform: %s", err)
}
dr := newDockerRunner(false)
dr := NewDockerRunner(false)
builderName := getBuilderForPlatform(p.Architecture, buildersMap)
client, err := dr.Builder(ctx, builderName, builderImage, builderConfigPath, platform, false)
if err != nil {