Odo: Fix `odo update`

Created on 23 Sep 2019  Â·  7Comments  Â·  Source: openshift/odo

Since odo config set can achieve the same, what should be done with the command? Should we remove it?

kindiscussion point5 prioritHigh

Most helpful comment

For the record this is the fifth issue that belongs to Dharmit-found-this-while-recording-demo-videos list. I think we should create a label for that now. Fifth issue in less than four videos. Yay! o/

All 7 comments

For the record this is the fifth issue that belongs to Dharmit-found-this-while-recording-demo-videos list. I think we should create a label for that now. Fifth issue in less than four videos. Yay! o/

At the end of below mentioned steps, I expected the odo config view to show that SourceType was local and SourceLocation was ./

$ odo create python --git https://github.com/dharmit/django-ex
$ odo push

$ odo update python-dcta --local ./
 ✓  Retrieving component data [32ms]
 ✓  Triggering build from git [52ms]
 ✓  Waiting for build to finish [32s]
 ✓  Applying configuration [6s]
 ✓  The component python-dcta was updated successfully

$ odo config view
COMPONENT SETTINGS
------------------------------------------------
PARAMETER         CURRENT_VALUE
Type              python
Application       app
Project           myproject
SourceType        git
Ref               
SourceLocation    https://github.com/dharmit/django-ex
Ports             8080/TCP
Name              python-dcta
MinMemory         
MaxMemory         
Ignore            
MinCPU            
MaxCPU            

@mik-dass you are right technically the same thing that update does can be achieved by two odo config set commands.

But I think that it is important to have one single command that does this operation.

But I think that it is important to have one single command that does this operation.

OK. I guess then I will rename the issue to be about fixing the command

the idea here is that currently odo update does many things internally for example if we change the type of the component from local to git - it does everything that a odo push would do ( with maybe some cleanups ).
So as per the observation done by @mik-dass . We can mostly ( need to go over more code ) replicate odo update whole functionality by doing odo config set and then odo push. so all the moving parts inside odo update can use this.
We would be able to remove a lot of code from update due to this

so all the moving parts inside odo update can use this.
We would be able to remove a lot of code from update due to this

Sounds good to me :+1:

So I went through the code and it seems that push actually depends on Update and not the other way around.
Check out this ApplyConfig function https://github.com/openshift/odo/blob/c9fc9757336dbcf8c422bcd06884ae78c4c3c30f/pkg/odo/cli/component/common_push.go#L85 which is present in the common_push code ( code called by everything that uses push )
The ApplyConfig function uses the Update function https://github.com/openshift/odo/blob/c9fc9757336dbcf8c422bcd06884ae78c4c3c30f/pkg/component/component.go#L539

So we cannot remove the Update code

Was this page helpful?
0 / 5 - 0 ratings