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

support kusion preview --ouput json #346

Merged
merged 3 commits into from
May 16, 2023

Conversation

healthjyk
Copy link
Contributor

@healthjyk healthjyk commented May 15, 2023

What type of PR is this?

feature

What this PR does / why we need it:

when using cmd kusion preview, there is no way to get the pure preview result, cause there is prompt. Support --output json to print the preview result without any unnecessary prompt when succeeded.

Which issue(s) this PR fixes:

Fixes #265

Special notes for your reviewer:

Does this PR introduce a user-facing change?

the output is json marshal of struct pkg/engine/operation/models.Changes

Additional documentation e.g., design docs, usage docs, etc.:

None

@coveralls
Copy link

coveralls commented May 15, 2023

Pull Request Test Coverage Report for Build 4988781634

  • 16 of 28 (57.14%) changed or added relevant lines in 3 files are covered.
  • 7 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.1%) to 71.734%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/engine/operation/models/action.go 0 3 0.0%
pkg/cmd/preview/options.go 14 23 60.87%
Files with Coverage Reduction New Missed Lines %
pkg/cmd/apply/options.go 7 71.31%
Totals Coverage Status
Change from base Build 4955951961: -0.1%
Covered Lines: 4870
Relevant Lines: 6789

💛 - Coveralls

amyXia1994
amyXia1994 previously approved these changes May 16, 2023
Copy link
Contributor

@amyXia1994 amyXia1994 left a comment

Choose a reason for hiding this comment

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

lgtm

@healthjyk
Copy link
Contributor Author

lgtm

lgtm

@amyXia1994 If there is no resource in the planned spec, there will be an empty output when --output json, you may need a judgement before json unmarshal. For the case without --output json, there is a hint, but still with successful preview.

Copy link
Member

@SparkYuan SparkYuan left a comment

Choose a reason for hiding this comment

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

lgtm

@SparkYuan SparkYuan merged commit ebeba65 into KusionStack:main May 16, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2023
@healthjyk healthjyk deleted the preview-output-json branch December 27, 2023 03:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Kusion provides API for integration tools
4 participants