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

Feat: support vela def vet the input "dir" and many cue files #5806

Merged
merged 11 commits into from
Apr 7, 2023

Conversation

Mcduller
Copy link
Contributor

@Mcduller Mcduller commented Apr 6, 2023

Description of your changes

Fixes #4744

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Special notes for your reviewer

Signed-off-by: Mcduller <1596582524@qq.com>
Signed-off-by: Mcduller <1596582524@qq.com>
…vet_dir

# Conflicts:
#	references/cli/test-data/defapply/testdef.cue
@github-advanced-security
Copy link

You have successfully added a new Trivy configuration .github/workflows/trivy-scan.yml:images. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@Mcduller Mcduller changed the title Feat: support vela def vet the input "dir" and many cue files @Mcduller Feat: support vela def vet the input "dir" and many cue files Apr 6, 2023
Copy link
Collaborator

@Somefive Somefive left a comment

Choose a reason for hiding this comment

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

Generally LGTM after nit, great job!

if err := def.FromCUEString(string(cueBytes), config); err != nil {
return errors.Wrapf(err, "failed to parse CUE")
for _, arg := range args {
files, err := utils.LoadDataFromPath(context.Background(), arg, utils.IsCUEFile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

context.Background() -> cmd.Context()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

if err != nil {
return err
}
streams.Infonln(validateRes)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can use fmt.Fprintf(cmd.Stdout, "xxx") instead of streams.Infoln

…vet_dir

Signed-off-by: Mcduller <1596582524@qq.com>

# Conflicts:
#	references/cli/test-data/defapply/testdef.cue
…vet_dir

Signed-off-by: Mcduller <1596582524@qq.com>

# Conflicts:
#	references/cli/test-data/defapply/testdef.cue
Copy link
Member

@charlie0129 charlie0129 left a comment

Choose a reason for hiding this comment

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

Minor usage text improvements

Comment on lines 1042 to 1049
"> vela def vet my-def.cue\n" +
"# Command below will validate all the cue file\n" +
"> vela def vet my-def1.cue my-def2.cue my-def3.cue\n" +
"# Command below will validate all the cue in specific dir\n" +
"> vela def vet ./test/" +
"# Command below will validate all the cue files in all specific dirs" +
"> vela def vet ./test1/ ./test2/",
Args: cobra.MinimumNArgs(1),
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"> vela def vet my-def.cue\n" +
"# Command below will validate all the cue file\n" +
"> vela def vet my-def1.cue my-def2.cue my-def3.cue\n" +
"# Command below will validate all the cue in specific dir\n" +
"> vela def vet ./test/" +
"# Command below will validate all the cue files in all specific dirs" +
"> vela def vet ./test1/ ./test2/",
Args: cobra.MinimumNArgs(1),
"> vela def vet my-def.cue\n" +
"# Validate every cue file provided\n" +
"> vela def vet my-def1.cue my-def2.cue my-def3.cue\n" +
"# Validate every cue file in the specified directories" +
"> vela def vet ./test1/ ./test2/",
Args: cobra.MinimumNArgs(1),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.10 ⚠️

Comparison is base (06eb414) 61.65% compared to head (3b65443) 61.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5806      +/-   ##
==========================================
- Coverage   61.65%   61.56%   -0.10%     
==========================================
  Files         217      217              
  Lines       30711    30696      -15     
==========================================
- Hits        18934    18897      -37     
- Misses      10034    10050      +16     
- Partials     1743     1749       +6     
Flag Coverage Δ
core-unittests 55.75% <0.00%> (-0.06%) ⬇️
e2e-multicluster-test 25.73% <0.00%> (-0.01%) ⬇️
e2e-rollout-tests 22.30% <0.00%> (+0.03%) ⬆️
e2etests 27.91% <0.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/utils/file.go 50.72% <0.00%> (-1.52%) ⬇️

... and 10 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@Somefive Somefive left a comment

Choose a reason for hiding this comment

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

Great job! Thanks for the contribution!

@Somefive Somefive merged commit eba40ab into kubevela:master Apr 7, 2023
26 of 27 checks passed
@Mcduller Mcduller deleted the vela_def_vet_dir branch April 7, 2023 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] "vela def vet" can support the input "dir" and many cue files
3 participants