-
Notifications
You must be signed in to change notification settings - Fork 244
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
Adds delete function for devfiles support. #2763
Adds delete function for devfiles support. #2763
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2763 +/- ##
==========================================
+ Coverage 43.53% 43.67% +0.14%
==========================================
Files 94 95 +1
Lines 8743 8762 +19
==========================================
+ Hits 3806 3827 +21
- Misses 4569 4571 +2
+ Partials 368 364 -4
Continue to review full report at Codecov.
|
e571a43
to
aefce34
Compare
7aa5735
to
ef267e0
Compare
/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 |
This PR also adds support for all flag. The all flag deletes the env folder present in the .odo folder. Signed-off-by: mik-dass <mrinald7@gmail.com>
os.Setenv("GLOBALODOCONFIG", filepath.Join(context, "config.yaml")) | ||
|
||
// Devfile commands require experimental mode to be set | ||
helper.CmdShouldPass("odo", "preference", "set", "Experimental", "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.
Smart!!!
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.
:D
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.
agreed +1
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.
@mik-dass if you dont mind, i shall make this change for the push integration tests when i am putting up a PR
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 like this and I already did that in my odo create
PR, we should apply that to all integration tests under tests/integration/devfile/
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.
@mik-dass if you dont mind, i shall make this change for the push integration tests when i am putting up a PR
Sure no problem
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.
UTs and Integration test looks good to me, however it would be great if dev folks including IBM folks will have a look and share their comments
Ping @GeekArthur @johnmcollier @elsony @dharmit @girishramnani
EDIT: Created #2832 for missing |
Yes #2591 (comment)
Currently, I was just deleting the env folder only. I will update the PR to delete the entire |
@dharmit |
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!
Amazing how there are more tests than actual code (which is awesome!)
/lgtm
Good change, tested it and worked well! Just had some thoughts -
It would be nice if the prompt told me the component name in the question as well, esp with the context flag. Thoughts? |
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 Overall changes look good to me and work as expected.
I left a couple comments on some suggestions to consider in the future, as we add more devfile support to odo.
@@ -137,3 +137,40 @@ func getNamespace() (string, error) { | |||
Namespace := envInfo.GetNamespace() | |||
return Namespace, nil | |||
} | |||
|
|||
// DevfileComponentDelete deletes the devfile component | |||
func (do *DeleteOptions) DevfileComponentDelete() 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.
Something to keep in mind: Rather than having a single devfile.go that contains the functions for push, delete, etc. We should probably separate them out into their own files.
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.
👍 We should have a look into it.
@@ -74,6 +98,39 @@ func (do *DeleteOptions) Run() (err error) { | |||
glog.V(4).Infof("component delete called") | |||
glog.V(4).Infof("args: %#v", do) | |||
|
|||
if experimental.IsExperimentalModeEnabled() && util.CheckPathExists(do.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.
Another thought I've had: We've been using if blocks in the Complete/Validate/Run
sections of each CLI command for devfile support, I wonder if we should move them into devfileComplete/devfileValidate/devfileRun
sections to avoid cluttering the code?
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.
Sounds good 👍 I have moved the Run() part for devfiles into a seperate function #2842 for now.
/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. |
/test v4.1-integration-e2e-benchmark |
/retest Please review the full test history for this PR and help us cut down flakes. |
@maysunfaisal @dharmit I have addressed the above suggestions in a follow up PR #2842. Please have a look :) |
Signed-off-by: mik-dass mrinald7@gmail.com
What type of PR is this?
/kind feature
What does does this PR do / why we need it:
This PR also adds support for all flag. The all flag deletes the env folder present in the .odo folder.
Which issue(s) this PR fixes:
Fixes #2591
How to test changes / Special notes to the reviewer:
odo push
on a devfile componentodo delete -f
and check if the devfile component is deleted from the clusterTest the --all flag
odo push
on a devfile componentodo delete -f --all
and check if the devfile component is deleted from the cluster. Also check if the env folder is deleted from the.odo
folder