Browse code

Builder - dockerfile - just use API for now, and unit test fix

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2017/10/04 03:32:54
Showing 2 changed files
... ...
@@ -105,17 +105,11 @@ func (bm *BuildManager) Build(ctx context.Context, config backend.BuildConfig) (
105 105
 	}
106 106
 
107 107
 	os := runtime.GOOS
108
-	optionsPlatform := system.ParsePlatform(config.Options.Platform)
109
-	if dockerfile.OS != "" {
110
-		if optionsPlatform.OS != "" && optionsPlatform.OS != dockerfile.OS {
111
-			return nil, fmt.Errorf("invalid platform")
112
-		}
113
-		os = dockerfile.OS
114
-	} else if optionsPlatform.OS != "" {
115
-		os = optionsPlatform.OS
108
+	apiPlatform := system.ParsePlatform(config.Options.Platform)
109
+	if apiPlatform.OS != "" {
110
+		os = apiPlatform.OS
116 111
 	}
117 112
 	config.Options.Platform = os
118
-	dockerfile.OS = os
119 113
 
120 114
 	builderOptions := builderOptions{
121 115
 		Options:        config.Options,
... ...
@@ -208,6 +208,7 @@ func TestOnbuild(t *testing.T) {
208 208
 func TestWorkdir(t *testing.T) {
209 209
 	b := newBuilderWithMockBackend()
210 210
 	sb := newDispatchRequest(b, '`', nil, newBuildArgs(make(map[string]*string)), newStagesBuildResults())
211
+	sb.state.baseImage = &mockImage{}
211 212
 	workingDir := "/app"
212 213
 	if runtime.GOOS == "windows" {
213 214
 		workingDir = "C:\\app"