Bug 1279288 - Wrong spec.source.type of bc could be saved and built without warning message.
Wrong spec.source.type of bc could be saved and built without warning message.
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Build (Show other bugs)
3.x
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Ben Parees
Wenjing Zheng
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-08 22:22 EST by XiaochuanWang
Modified: 2016-05-12 13:11 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-12 13:11:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description XiaochuanWang 2015-11-08 22:22:23 EST
Description of problem:
Edit and save the spec.source.type with anything except "Git", i.e. "Git123", modified bc could create bc

Version-Release number of selected component (if applicable):
openshift v1.0.8-2-g769ca7a
kubernetes v1.1.0-origin-1107-g4c8e6f4
etcd 2.1.2

How reproducible:
Always

Steps to Reproduce:
1. Create a new project
2. Process and create with application-template-stibuild.json
$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. oc edit bc php-sample-build, set spec.source.type to "Git123"

Actual results:
"Git123" is saved without any warning.

Expected results:
Either below warnings should appear and it cannot be saved
# BuildConfig <bc> was not valid:
# * spec.source.type: required value

Additional info:
Recreate bc based on modified bc, could also be succesful
OpenShift:xiaocwan openshift$ oc get bc/php-sample-build -o json > bc1.json
OpenShift:xiaocwan openshift$ oc delete bc php-sample-build
buildconfig "php-sample-build" deleted
OpenShift:xiaocwan openshift$ oc create -f bc1.json
buildconfig "php-sample-build" created
Comment 1 Cesar Wong 2015-11-09 09:09:36 EST
We likely don't want to add validation for the source type since in the future we may have source types that we don't have now. However, when the build runs, if it has a source type that the builder doesn't understand, the build should end in an error.
Comment 2 Ben Parees 2015-11-09 11:42:06 EST
back to QE to confirm the build fails with a useful message.
Comment 3 XiaochuanWang 2015-11-10 04:23:25 EST
Same step as additional, there is no expect message:
# oc process -f https://raw.githubusercontent.com/openshift/origin/master/examples/sample-app/application-template-stibuild.json | oc create -f -
# oc get build
NAME                  TYPE      FROM      STATUS    STARTED         DURATION
ruby-sample-build-1   Source    Git       Running   4 seconds ago   4s
# oc get bc
# oc get bc/ruby-sample-build -o json > bc.json
# vim bc.json
# oc delete bc ruby-sample-build
# oc create -f bc.json
# oc start-build ruby-sample-build

# oc get build
NAME                  TYPE      FROM      STATUS     STARTED          DURATION
ruby-sample-build-1   Source    Git       Complete   4 minutes ago    39s
ruby-sample-build-2   Source    Git       Complete   47 seconds ago   29s

# oc get pod
NAME                        READY     STATUS      RESTARTS   AGE
database-1-h6m1x            1/1       Running     0          5m
frontend-2-2yef5            1/1       Running     0          1m
frontend-2-ue2k4            1/1       Running     0          1m
ruby-sample-build-1-build   0/1       Completed   0          5m
ruby-sample-build-2-build   0/1       Completed   0          2m

# oc build-logs ruby-sample-build-2
Command "build-logs" is deprecated, use "logs" instead.
---> Installing application source ...
---> Building your Ruby application from source ...
---> Running 'bundle install --deployment' ...
Fetching gem metadata from https://rubygems.org/..........
Installing rake (10.3.2)
Installing i18n (0.6.11)
Installing json (1.8.3)
Installing minitest (5.4.2)
Installing thread_safe (0.3.4)
Installing tzinfo (1.2.2)
Installing activesupport (4.1.7)
Installing builder (3.2.2)
Installing activemodel (4.1.7)
Installing arel (5.0.1.20140414130214)
Installing activerecord (4.1.7)
Installing mysql2 (0.3.16)
Installing rack (1.5.2)
Installing rack-protection (1.5.3)
Installing tilt (1.4.1)
Installing sinatra (1.4.5)
Installing sinatra-activerecord (2.0.3)
Using bundler (1.3.5)
Your bundle is complete!
It was installed into ./bundle
---> Cleaning up unused ruby gems ...
I1110 09:18:48.944906       1 sti.go:213] Using provided push secret for pushing 172.30.202.55:5000/xiaocwan/origin-ruby-sample:latest image
I1110 09:18:48.944951       1 sti.go:217] Pushing 172.30.202.55:5000/xiaocwan/origin-ruby-sample:latest image ...
I1110 09:18:49.635050       1 sti.go:233] Successfully pushed 172.30.202.55:5000/xiaocwan/origin-ruby-sample:latest

Version:
oc v1.0.8-4-gabfc3c4
openshift v1.0.8-4-gabfc3c4
oadm v1.0.8-4-gabfc3c4
kubernetes v1.1.0-origin-1107-g4c8e6f4
Comment 4 Ben Parees 2015-11-10 09:02:03 EST
I guess because we only have one source type (git) we don't do any checking on that field.  will add some.
Comment 5 Ben Parees 2015-11-11 13:20:03 EST
https://github.com/openshift/origin/pull/5853
Comment 6 XiaochuanWang 2015-11-15 21:19:48 EST
Added value validate for json, this is verified on origin. 
oc v1.1-25-g0c0e452
openshift v1.1-25-g0c0e452
oadm v1.1-25-g0c0e452
kubernetes v1.1.0-origin-1107-g4c8e6f4

Note You need to log in before you can comment on or make changes to this bug.