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

odo init json output #5658

Merged
merged 12 commits into from
Apr 19, 2022

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Apr 13, 2022

What type of PR is this:

/kind feature

What does this PR do / why we need it:

  • Centralize objects returned by JSON output in pkg/api package
  • Adds JSON output to odo init command

Which issue(s) this PR fixes:

Fixes #5645

PR acceptance criteria:

  • Unit test

  • Integration test

  • Documentation

How to test changes / Special notes to the reviewer:

@netlify
Copy link

netlify bot commented Apr 13, 2022

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
🔨 Latest commit 69c3ab8
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/625848d3da9d1600084506f0

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Apr 13, 2022
@openshift-ci openshift-ci bot requested review from anandrkskd and kadel April 13, 2022 07:50
@feloy feloy changed the title Odo init json main odo init json output Apr 13, 2022
@feloy feloy requested review from rm3l and valaparthvi and removed request for kadel and anandrkskd April 13, 2022 07:52
@odo-robot
Copy link

odo-robot bot commented Apr 13, 2022

Unit Tests on commit c5b54cc finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 13, 2022

Kubernetes Tests on commit c5b54cc finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 13, 2022

OpenShift Tests on commit c5b54cc finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Apr 13, 2022

Validate Tests on commit c5b54cc finished successfully.
View logs: TXT HTML

@feloy feloy force-pushed the odo-init-json-main branch from 482b02d to 716a3f3 Compare April 13, 2022 13:46
@feloy feloy changed the title odo init json output [WIP] odo init json output Apr 13, 2022
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Apr 13, 2022
@feloy feloy changed the title [WIP] odo init json output odo init json output Apr 13, 2022
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Apr 13, 2022
@feloy feloy requested a review from kadel April 13, 2022 18:47
Comment on lines 130 to 137
commands, _ := devfileObj.Data.GetCommands(common.DevfileOptions{
CommandOptions: common.CommandOptions{
CommandGroupKind: v1alpha2.DeployCommandGroupKind,
},
})
if len(commands) != 0 {
exitMessage += "\nTo deploy your component to a cluster use \"odo deploy\"."
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you replace this with libdevfile.HasDeployCommand() method?

Suggested change
commands, _ := devfileObj.Data.GetCommands(common.DevfileOptions{
CommandOptions: common.CommandOptions{
CommandGroupKind: v1alpha2.DeployCommandGroupKind,
},
})
if len(commands) != 0 {
exitMessage += "\nTo deploy your component to a cluster use \"odo deploy\"."
}
if libdevfile.HasDeployCommand(devfileObj.Data) {
exitMessage += "\nTo deploy your component to a cluster use \"odo deploy\"."
}

@feloy feloy requested a review from valaparthvi April 14, 2022 06:22
@feloy feloy force-pushed the odo-init-json-main branch from dc034e1 to 847138c Compare April 14, 2022 08:24
Comment on lines +149 to +151
ForwardedPorts: []api.ForwardedPort{},
RunningIn: []api.RunningMode{},
ManagedBy: "odo",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also add these fields in the JSON output in the docs?

@feloy feloy requested a review from valaparthvi April 14, 2022 11:53
Copy link
Member

@rm3l rm3l left a comment

Choose a reason for hiding this comment

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

I added a few comments, mainly for cosmetic changes. LGTM otherwise after testing your changes.

pkg/api/component.go Outdated Show resolved Hide resolved
pkg/api/doc.go Outdated Show resolved Hide resolved
@feloy feloy requested a review from rm3l April 14, 2022 16:16
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 15, 2022
@valaparthvi
Copy link
Contributor

/approve

@openshift-ci
Copy link

openshift-ci bot commented Apr 19, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: valaparthvi

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Apr 19, 2022
@openshift-merge-robot openshift-merge-robot merged commit 4527363 into redhat-developer:main Apr 19, 2022
@feloy feloy mentioned this pull request Apr 25, 2022
7 tasks
cdrage pushed a commit to cdrage/odo that referenced this pull request Aug 31, 2022
* odo init -o json

* docs

* fix header and json

* Make DevfileLocation part of api package

* Add Component api kind

* odo init -o json return value

* Document api package

* Update tests

* review

* Error when json output and no flags

* Update doc

* review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an odo init -o json command
4 participants