Bug 1267474 - oc patch cannot update some fields of buildconfig
oc patch cannot update some fields of buildconfig
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: David Eads
Wei Sun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-30 03:08 EDT by Xingxing Xia
Modified: 2018-04-12 03:20 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-23 16:14:02 EST
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 Xingxing Xia 2015-09-30 03:08:53 EDT
Description of problem:
oc patch cannot update some fields of buildconfig

Version-Release number of selected component (if applicable):
openshift v1.0.6-266-gcfbe4fb
oc v1.0.6-266-gcfbe4fb
kubernetes v1.1.0-alpha.1-653-g86b4e77

How reproducible:
Always

Steps to Reproduce:
1.Launch openshift
2.Login, create a project and create applications
3.Check bc resource
1> $ oc get bc
2> $ oc get bc ruby-sample-build -t '{{ .spec.output.to.name }}' | grep '.'
4.Update field
$ oc patch bc ruby-sample-build -p '{"spec":{"output":{"to":{"name":"origin-ruby-sample:tag1"}}}}'
5.Check the update
$ oc get bc ruby-sample-build -t '{{ .spec.output.to.name }}' | grep '.'
6.Update other fields of bc, such as spec.source.git.uri


Actual results:
3.
2>
origin-ruby-sample:latest
4.
Error from server: unable to find api field in struct BuildSpec for the json field "to"
6. Similar error:
Error from server: unable to find api field in struct BuildSpec for the json field "git"


Expected results:
4.
"ruby-sample-build" patched
5.
origin-ruby-sample:tag1
6. Should also succeed.


Additional info:
The above fields can be updated by 'oc edit bc'.
oc patch can update some fields of buildconfig, such as metadata.labels.template.
oc patch can update deep level field of deploymentconfig, such as spec.strategy.recreateParams.pre.failurePolic
Comment 2 David Eads 2015-10-02 15:22:38 EDT
in the merge queue.
Comment 3 Xingxing Xia 2015-10-09 04:41:46 EDT
I checked on the version:
oc/openshift v1.0.6-466-g72df0dc
kubernetes v1.1.0-alpha.1-653-g86b4e77.
The issue has been fixed, now oc patch can update "spec" sub-fields of buildconfig
Comment 4 Akram Ben Aissi 2018-04-12 03:20:04 EDT
Hi,

it doesn't seem to work with source strategy:

oc patch bc/cotd -p '{ "spec" : { "strategy" : { "type" : "Binary" }}}'
buildconfig "cotd" not patched


you can reproduce with:

oc new-app openshift/php:5.6~https://github.com/devops-with-openshift/cotd
and then:
oc patch bc/cotd -p '{ "spec" : { "strategy" : { "type" : "Binary" }}}'


However the workaround with oc replace works, so, the field must be editable:
oc export bc/cotd  | sed s/Source/Binary/ | oc replace -f -

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