mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-03-19 15:26:21 +00:00
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:
committed by
Avi Deitcher
parent
bb0cf49975
commit
a1cfc53d3c
@@ -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
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
type dockerDryRunnerImpl struct {
|
||||
}
|
||||
|
||||
func newDockerDryRunner() DockerRunner {
|
||||
func NewDockerDryRunner() DockerRunner {
|
||||
return &dockerDryRunnerImpl{}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ type dockerRunnerImpl struct {
|
||||
cache bool
|
||||
}
|
||||
|
||||
func newDockerRunner(cache bool) DockerRunner {
|
||||
func NewDockerRunner(cache bool) DockerRunner {
|
||||
return &dockerRunnerImpl{cache: cache}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user