Skip to content
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

Swtich from 'odo' to 'oc' for create/set/get active/delete project and list ptojects #3826

Conversation

vrubezhny
Copy link
Contributor

@vrubezhny vrubezhny commented Jan 18, 2024

Issue: #3662

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 37 lines in your changes are missing coverage. Please review.

Comparison is base (f4d3c74) 32.41% compared to head (48612ba) 32.47%.
Report is 2 commits behind head on main.

Files Patch % Lines
src/oc/ocWrapper.ts 73.46% 13 Missing ⚠️
src/explorer.ts 12.50% 7 Missing ⚠️
src/openshift/component.ts 14.28% 6 Missing ⚠️
src/openshift/project.ts 0.00% 6 Missing ⚠️
src/serverlessFunction/functions.ts 0.00% 2 Missing ⚠️
src/yamlFileCommands.ts 60.00% 2 Missing ⚠️
src/util/loginUtil.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3826      +/-   ##
==========================================
+ Coverage   32.41%   32.47%   +0.06%     
==========================================
  Files          85       85              
  Lines        6396     6418      +22     
  Branches     1321     1333      +12     
==========================================
+ Hits         2073     2084      +11     
- Misses       4323     4334      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vrubezhny vrubezhny force-pushed the fix-switch-odo-to-oc-for-create-set-delete-project branch 19 times, most recently from 7858d98 to bebb7d9 Compare January 25, 2024 18:01
@vrubezhny vrubezhny marked this pull request as ready for review January 25, 2024 18:25
@vrubezhny vrubezhny changed the title Swtich from 'odo' to 'oc' for create/set/delete project Swtich from 'odo' to 'oc' for create/set/get active/delete project and list ptojects Jan 25, 2024
@vrubezhny vrubezhny self-assigned this Jan 25, 2024
lgrossma
lgrossma previously approved these changes Jan 26, 2024
Copy link
Collaborator

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small changes, but otherwise seems to working very well and the code looks good. Thanks, Victor!

new CommandText('oc', `delete ${obj} ${projectName}`)
)
.then((result) => result.stdout)
.catch((error) => error.message);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prevent the error from being thrown. This means that in order to tell if creating the project succeeds or fails, you will need to parse the string that's returned. I think it's better to avoid catching the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datho7561 Hm. Actually it's not correct. Previously we were using -f parameter when running odo commands which was preventing it from throwing any exceptions (f.i. when deleting non-existing projects).
Catching errors when an oc command is used makes it work asodo xxx -f did before, otherwise we'll have to surround every call to Oc.Instance.deleteProject() with a try-catch or errors in some other way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it will probably change some behaviour, but I think it should be okay. We should avoid presenting the option to delete a project that doesn't exist in the UI. Even if you attempted to, it would still display the error as a popup notification. (To confirm this, try deleting the default project on a kind cluster)

src/oc/ocWrapper.ts Outdated Show resolved Hide resolved
…d list ptojects

Issue: redhat-developer#3662

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
@vrubezhny vrubezhny force-pushed the fix-switch-odo-to-oc-for-create-set-delete-project branch from bebb7d9 to 48612ba Compare January 26, 2024 15:54
Copy link
Collaborator

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks, Victor!

@datho7561 datho7561 merged commit 976e968 into redhat-developer:main Jan 26, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants