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

Add odo project delete -o json #1960

Closed

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Jul 29, 2019

This PR:

  • Adds odo project delete -o json
  • Builds upon the global parameter and odo project create -o json
    commits

@cdrage cdrage added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. and removed size/L labels Jul 29, 2019
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign cdrage
You can assign the PR to them by writing /assign @cdrage in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cdrage
Copy link
Member Author

cdrage commented Jul 29, 2019

/hold

This PR builds upon #1898 and #1916 and thus requires both to be merged before anything :)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. label Jul 29, 2019
@cdrage cdrage force-pushed the add-delete-project-json branch from 59f795d to b10cd21 Compare July 29, 2019 20:23
@cdrage cdrage force-pushed the add-delete-project-json branch from b10cd21 to c176f3a Compare July 30, 2019 20:32
// If we error out... there's no way to output it (since we disable logging when using -o json)
if err != nil {
fmt.Printf("Unable to unmarshal JSON: %s", err.Error())
os.Exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

Exit code for failure to create a project and for failure to generate the machine readable output is same. How would someone who is using the API determine what the exact cause of error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally this should never happen, but unfortunately we do hide all non-json related output. What would happen upstream is that VSCode will be unable to marshal the JSON output anyways (it will output "Unable to unmarshal json... from Odo..").

I honestly couldn't think of a better solution.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I kind of assumed that the message (in this case "Unable to unmarshal JSON) would be a differentiator, but it still feels a bit skewed. I might sound pedantic here but if we have more such ambiguities w.r.t exit codes, it might come back to bite us since our APIs are going to be crucial for projects like Adapters. Correct me if I'm wrong.

Expect(desired).Should(MatchJSON(actual))
})
})

Copy link
Member

Choose a reason for hiding this comment

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

Similar tests for project deletion would also be helpful, no? One test that deletes an existing project and another where we try to delete a project that does not exist.

@amitkrout
Copy link
Contributor

@cdrage Are these CI failure related to your change ? Can you please check

@cdrage
Copy link
Member Author

cdrage commented Aug 20, 2019

@amitkrout Most likely. This PR is still WIP / need to rebase again.

cdrage added 3 commits August 20, 2019 14:46
Adds machine readable output for odo create project.

To test:

```sh
odo create project -o json
```
This PR:

 - Adds `odo project delete -o json`
 - Builds upon the global parameter and `odo project create -o json`
 commits
@cdrage cdrage force-pushed the add-delete-project-json branch from 1489cff to 319364f Compare August 20, 2019 18:46
@openshift-ci-robot
Copy link
Collaborator

@cdrage: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/integration 319364f link /test integration
ci/prow/e2e-scenarios 319364f link /test e2e-scenarios
ci/prow/benchmark 319364f link /test benchmark

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@cdrage
Copy link
Member Author

cdrage commented Aug 22, 2019

Too many changes / rebasing, I've opened up a new PR: #2037

@cdrage cdrage closed this Aug 27, 2019
@cdrage cdrage deleted the add-delete-project-json branch January 14, 2022 14:50
@rm3l rm3l added estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person. and removed size/L labels Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. Required by Prow. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. estimated-size/L (20-40) Rough sizing for Epics. About 2 sprints of work for a person.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants