-
Notifications
You must be signed in to change notification settings - Fork 859
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
Conversation
Signed-off-by: Mcduller <1596582524@qq.com>
Signed-off-by: Mcduller <1596582524@qq.com>
…vet_dir # Conflicts: # references/cli/test-data/defapply/testdef.cue
You have successfully added a new Trivy configuration |
There was a problem hiding this 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!
references/cli/def.go
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.Background() -> cmd.Context()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
references/cli/def.go
Outdated
if err != nil { | ||
return err | ||
} | ||
streams.Infonln(validateRes) |
There was a problem hiding this comment.
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
There was a problem hiding this 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
references/cli/def.go
Outdated
"> 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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"> 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), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
Codecov ReportPatch coverage has no change and project coverage change:
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
Flags with carried forward coverage won't be shown. Click here to find out more.
... 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. |
Signed-off-by: Mcduller <1596582524@qq.com>
Signed-off-by: Mcduller <1596582524@qq.com>
There was a problem hiding this 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!
Description of your changes
Fixes #4744
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Special notes for your reviewer