Do not necessarily error out if odo dev is stopped via Ctrl+C#6917
Merged
openshift-merge-robot merged 5 commits intoredhat-developer:mainfrom Jun 22, 2023
Conversation
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
Member
Author
|
Looking into the tests that are not passing... |
21ec4e7 to
ceb4872
Compare
feloy
approved these changes
Jun 22, 2023
See ExitInMain[1] and ExitInMain_ExitOnce[2] coding convention guidelines. [1] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-in-main [2] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-once
This makes sure the exit code of the command is mapped onto any error returned by Cleanup
ceb4872 to
9b891a7
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
Member
Author
|
Had to rebase onto |
feloy
approved these changes
Jun 22, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








What type of PR is this:
/kind bug
/area dev
/area refactoring
What does this PR do / why we need it:
This PR makes sure hitting
Ctrl-Cis not reported as an error. Well, the exit code is mapped onto any error returned while cleaning up the Dev resources.But in telemetry, no error should be reported.
To do so, it first starts with refactoring error handling, making sure errors are propagated correctly up to the CLI layer, so that non-nil errors would propagate as non-zero exit code and nil errors will be propagated as zero exit code.
See [1] and [2] for the rationale.
[1] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-in-main
[2] https://github.com/redhat-developer/odo/wiki/Dev:-Coding-Conventions#exit-once
Which issue(s) this PR fixes:
Fixes #6514
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer:
The exit code of
odo devis now mapped to the error returned when cleaning up the Dev resources. However, no error is reported in telemetry regardless of the status of the cleanup logic.