From 735e5d22b7ca208acc9ad7373bb8f93167ee3f85 Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 3 Oct 2017 11:32:54 -0700 Subject: [PATCH] Builder - dockerfile - just use API for now, and unit test fix Signed-off-by: John Howard --- builder/dockerfile/builder.go | 12 +++--------- builder/dockerfile/dispatchers_test.go | 1 + 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/builder/dockerfile/builder.go b/builder/dockerfile/builder.go index d20bc0403a..2a41c1f0c3 100644 --- a/builder/dockerfile/builder.go +++ b/builder/dockerfile/builder.go @@ -105,17 +105,11 @@ func (bm *BuildManager) Build(ctx context.Context, config backend.BuildConfig) ( } os := runtime.GOOS - optionsPlatform := system.ParsePlatform(config.Options.Platform) - if dockerfile.OS != "" { - if optionsPlatform.OS != "" && optionsPlatform.OS != dockerfile.OS { - return nil, fmt.Errorf("invalid platform") - } - os = dockerfile.OS - } else if optionsPlatform.OS != "" { - os = optionsPlatform.OS + apiPlatform := system.ParsePlatform(config.Options.Platform) + if apiPlatform.OS != "" { + os = apiPlatform.OS } config.Options.Platform = os - dockerfile.OS = os builderOptions := builderOptions{ Options: config.Options, diff --git a/builder/dockerfile/dispatchers_test.go b/builder/dockerfile/dispatchers_test.go index 6d52e7e619..7ad0d8d3c2 100644 --- a/builder/dockerfile/dispatchers_test.go +++ b/builder/dockerfile/dispatchers_test.go @@ -208,6 +208,7 @@ func TestOnbuild(t *testing.T) { func TestWorkdir(t *testing.T) { b := newBuilderWithMockBackend() sb := newDispatchRequest(b, '`', nil, newBuildArgs(make(map[string]*string)), newStagesBuildResults()) + sb.state.baseImage = &mockImage{} workingDir := "/app" if runtime.GOOS == "windows" { workingDir = "C:\\app"