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
odo create support existing devfile.yaml #2798
odo create support existing devfile.yaml #2798
Conversation
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
/assign |
componentType = ui.SelectDevfileComponentType(supDevfileCatalogList) | ||
|
||
// devfile.yaml is not present, user has to specify the component type | ||
if !util.CheckPathExists(DevfilePath) { |
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.
can we move this check before listing from registry, as for the case devfile is present it might save one call.
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.
Nice suggestion! I can do that to improve the performance.
pkg/odo/cli/component/create.go
Outdated
@@ -338,6 +342,10 @@ func (co *CreateOptions) Complete(name string, cmd *cobra.Command, args []string | |||
// Component type: Get from full command's first argument (mandatory) |
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.
move the comments at the right place, above componentType = args[0]
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.
Yup, I can refactor the comments for both interactive mode and direct mode
@@ -319,7 +319,11 @@ func (co *CreateOptions) Complete(name string, cmd *cobra.Command, args []string | |||
supDevfileCatalogList = append(supDevfileCatalogList, devfileComponent) | |||
} | |||
} | |||
componentType = ui.SelectDevfileComponentType(supDevfileCatalogList) | |||
|
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.
as [1] is the first check, if a <component-type
not present and devfile.yaml
is present, it is default going into interactive, IIUC it should create from existing devfile.yaml
[1]
if len(args) == 0 {
co.interactive = true
}
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, it should create the component using the existing devfile.yaml
, but user is still able to specify the <component name>
via interactive mode, that's why it falls down to interactive mode
/retest |
In the following scenario, the second
|
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
Codecov Report
@@ Coverage Diff @@
## master #2798 +/- ##
==========================================
+ Coverage 43.70% 43.81% +0.10%
==========================================
Files 102 102
Lines 9160 9160
==========================================
+ Hits 4003 4013 +10
+ Misses 4780 4774 -6
+ Partials 377 373 -4
Continue to review full report at Codecov.
|
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.
@GeekArthur Thanks for the pr.
We can add Integration test to validate the changes. Scenarios are pretty clear from your pr section of What does does this PR do / why we need it:
.
BTW we have an open issue #2194 for interactive mode test script implementation. So you can skip the interactive mode integration test atm.
/approve @GeekArthur it needs rebase |
[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 |
…ateImprovement Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
@kadel @amitkrout comments addressed, please review again, thanks! |
/retest |
…ateImprovement Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
/retest |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
…ateImprovement Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
/retest |
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.
Adding back the lgtm label since it was removed with the rebase earlier
/lgtm
…ateImprovement Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
Re-adding the lgtm after rebase |
/retest |
2 similar comments
/retest |
/retest |
Signed-off-by: jingfu wang <jingfu.j.wang@ibm.com>
re-add lgtm after rebase |
/retest |
3 similar comments
/retest |
/retest |
/retest |
Signed-off-by: jingfu wang jingfu.j.wang@ibm.com
What type of PR is this?
/kind feature
What does does this PR do / why we need it:
This PR improves the
odo create
to make it support the following use cases:If devfile.yaml is not present
Case 1:
odo create <component type>
-> odo downloads devfile from devfile registry and creates env.yamlCase 2:
odo create
-> User can specify component type via interactive mode, then odo downloads devfile from devfile egistry and creates env.yamlIf devfile.yaml is present
Case 1:
odo create <component type>
-> odo throws errors and tells user to delete the existing devfile.yaml then run odo create againCase 2:
odo create
-> odo directly uses the existing devfile.yaml and creates env.yaml, user can specify component name via interactive modeWhich issue(s) this PR fixes:
Fixes #2789
How to test changes / Special notes to the reviewer:
N/A