Bug 1330871

Summary: No validation of build source type and build strategy type
Product: OpenShift Container Platform Reporter: Wang Haoran <haowang>
Component: BuildAssignee: Ben Parees <bparees>
Status: CLOSED CURRENTRELEASE QA Contact: Wang Haoran <haowang>
Severity: low Docs Contact:
Priority: low    
Version: 3.2.0CC: aos-bugs, bparees, tdawson
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-07 21:30:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Wang Haoran 2016-04-27 07:56:40 UTC
Description of problem:
When using oc edit to update the bc, and fill with the wrong type , when type :wq , vim exited successfully.

Version-Release number of selected component (if applicable):
openshift v3.2.0.20
kubernetes v1.2.0-36-g4a3f9c5
etcd 2.2.5


How reproducible:
always

Steps to Reproduce:
1.Create a project
2.Create a app
oc process -f https://raw.githubusercontent.com/openshift-qe/v3-testfiles/master/image/language-image-templates/php-56-rhel7-stibuild.json| oc create -f -
3.edit the bc update the source type to Git123
oc edit bc php-sample-build
spec:
..............
source:
    git:
      uri: https://github.com/wzheng1/php-example-app
    type: Git123
4. edit bc update the build strategy to Source123
strategy:
    sourceStrategy:
      from:
        kind: ImageStreamTag
        name: php-56-rhel7:latest
    type: Source123
Actual results:

step 3 and 4 succeed.
Expected results:
Should not save sucessfully and pop out the wrong message,validation should be more restrict.
Additional info:
There is a bug before https://bugzilla.redhat.com/show_bug.cgi?id=1279288 , which fixed this , but after update the bc structure , It appears again.
code here:
https://github.com/openshift/origin/blob/master/pkg/build/api/validation/validation.go#L373
https://github.com/openshift/origin/blob/master/pkg/build/api/validation/validation.go#L132

Comment 1 Wang Haoran 2016-05-01 14:44:33 UTC
According to this commit[1], disable the type validation is to support multiple source input , if this is not a bug , feel free to close this.

[1]https://github.com/openshift/origin/commit/6d31fd277df0632bbb96ecea64e79d10b7e55d27

Comment 2 Ben Parees 2016-06-27 15:46:57 UTC
That field is now deprecated, so you can put any value you want into it, it will be ignored and you'll notice that when you view the buildconfig again, the type field will be reset to the appropriate value based on which strategy field is defined.