Bug 1267474 - oc patch cannot update some fields of buildconfig
Summary: oc patch cannot update some fields of buildconfig
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: David Eads
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-30 07:08 UTC by Xingxing Xia
Modified: 2018-04-12 07:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-23 21:14:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xingxing Xia 2015-09-30 07:08:53 UTC
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 19:22:38 UTC
in the merge queue.

Comment 3 Xingxing Xia 2015-10-09 08:41:46 UTC
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 07:20:04 UTC
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.