New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove duplicate list and refactor #4177
remove duplicate list and refactor #4177
Conversation
@dgolovin This might change the |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@girishramnani unit test |
78623e5
to
bf95aaf
Compare
unit test should be resolved now |
Codecov Report
@@ Coverage Diff @@
## master #4177 +/- ##
==========================================
- Coverage 42.56% 42.35% -0.22%
==========================================
Files 156 154 -2
Lines 13266 13197 -69
==========================================
- Hits 5647 5589 -58
+ Misses 7017 6999 -18
- Partials 602 609 +7
Continue to review full report at Codecov.
|
@@ -856,8 +856,33 @@ func GetComponentNames(client *occlient.Client, applicationName string) ([]strin | |||
return names, nil | |||
} | |||
|
|||
// List lists components in active application | |||
func List(client *occlient.Client, applicationName string, localConfigInfo *config.LocalConfigInfo) (ComponentList, error) { | |||
func ListDevfileComponents(client *occlient.Client, selector string) (ComponentList, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 especially description for selector.
It looks a little bit weird to me as we don't use selectors for odo components. Why not keep applicationName
are we ever going to use something else then application name selector?
ListS2IComponents
has applicationName
argument, it would be nice to match that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes @kadel - we use the project selector when we want to have components from all application, but in case of s2i components - we list all applications and then list per component application
https://github.com/openshift/odo/blob/e5798c42c9ce191425e3ed18e52db985e1e2f920/pkg%2Fodo%2Fcli%2Fcomponent%2Flist.go#L254-L261
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the S2I approach is not optimised as it Xn calls to the where n is the number of applications and X is the calls done per application.
components = append(components, component) | ||
} | ||
|
||
compoList := GetMachineReadableFormatForList(components) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for returning the machine readable output here.
// List lists all components in active application | ||
func List(client *occlient.Client, applicationName string, localConfigInfo *config.LocalConfigInfo) (ComponentList, error) { | ||
var applicationSelector string | ||
if applicationName != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the applicationName
field will be ""
or nil for some reason, what would happen to the calls to ListDevfileComponents
and ListS2Icomponents
below?
Is there going to be a situation where this field could be empty? Isn't that something that CLI level should prevent from happening?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not exactly sure if CLI prevents it but as List
actually checks the local component as well - chances are that doesn't require application name
Type string `json:"type,omitempty"` | ||
SourceType string `json:"sourceType,omitempty"` | ||
S2IComponents []Component `json:"s2iComponents"` | ||
DevfileComponents []Component `json:"devfileComponents"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking out loud. Can we have Items
and make S2IComponents
& DevfileComponents
a part of it? I'm asking this because it'll help us have uniformity with the way k8s returns a list of items. This should also cascade to the way we return list of services, AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking as part of refactor we might consolidate these two list with a new label called IsLegacy
once devfile matures further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you mean that we can have just one list called Items
and then in the individual items, there could be a bool label IsLegacy
which indicates that it's an s2i component, right? Sounds good to me. Or we could label it IsS2i
. But that's a separate discussion for when we refactor it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
@girishramnani will this PR also fix #4023? Not asking that it should, just wondering if it would. |
actually that one has a bigger problem which we might not be able to solve right now |
06171fa
to
047056f
Compare
@girishramnani Multiple test cases failing in unit test |
c6cf27c
to
9ec4963
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
What type of PR is this?
/kind bug
/kind cleanup
What does does this PR do / why we need it:
odo list
printing devfile components as s2i componentsKclient
directly in the cliDeployment
struct ( structs from the lowest ) layer in the cli layerWhich issue(s) this PR fixes:
Fixes #4144
PR acceptance criteria:
Unit test
Integration test
Documentation
I have read the test guidelines
How to test changes / Special notes to the reviewer: