Browse code

Merge pull request #6679 from rhcarvalho/issue6675-dockerfile-in-bc

Merged by openshift-bot

OpenShift Bot authored on 2016/01/16 09:37:00
Showing 2 changed files
... ...
@@ -90,6 +90,8 @@ type SourceRepository struct {
90 90
 	buildWithDocker  bool
91 91
 	ignoreRepository bool
92 92
 	binary           bool
93
+
94
+	forceAddDockerfile bool
93 95
 }
94 96
 
95 97
 // NewSourceRepository creates a reference to a local or remote source code repository from
... ...
@@ -259,6 +261,7 @@ func (r *SourceRepository) AddDockerfile(contents string) error {
259 259
 	}
260 260
 	r.info.Dockerfile = dockerfile
261 261
 	r.buildWithDocker = true
262
+	r.forceAddDockerfile = true
262 263
 	return nil
263 264
 }
264 265
 
... ...
@@ -378,7 +381,7 @@ func StrategyAndSourceForRepository(repo *SourceRepository, image *ImageRef) (*B
378 378
 		Binary: repo.binary,
379 379
 	}
380 380
 
381
-	if repo.Info() != nil && repo.Info().Dockerfile != nil {
381
+	if (repo.ignoreRepository || repo.forceAddDockerfile) && repo.Info() != nil && repo.Info().Dockerfile != nil {
382 382
 		source.DockerfileContents = repo.Info().Dockerfile.Contents()
383 383
 	}
384 384
 	if !repo.ignoreRepository {
... ...
@@ -167,4 +167,7 @@ os::cmd::expect_success 'oc new-app mongo -o json | python -m json.tool'
167 167
 # Ensure custom branch/ref works
168 168
 os::cmd::expect_success 'oc new-app https://github.com/openshift/ruby-hello-world#beta4'
169 169
 
170
+# Ensure the resulting BuildConfig doesn't have unexpected sources
171
+os::cmd::expect_success_and_not_text 'oc new-app https://github.com/openshift/ruby-hello-world --output-version=v1 -o=jsonpath="{.items[?(@.kind==\"BuildConfig\")].spec.source}"' 'dockerfile|binary'
172
+
170 173
 echo "new-app: ok"