Skip to content

Commit

Permalink
Add support for external bundle validators (#5525)
Browse files Browse the repository at this point in the history
* add pkg/validate: external validation runner
* add --alpha-select-external flag
* updated external.go to use value from --alpha-select-external
* updated validate.go to use the new --alpha-select-external
* add alpha-select-external to longhelp
* add comment detailing the flag usage.
* remove environment variable
* remove parameters validation stub
* return manifestresults all the way through
* add unit tests for new implementation
* update cli doc 
* return a bool instead of a hard exit.
* avoid reading the entire output of the validator command into memory.
* remove mockable exit var as it is no longer needed

Signed-off-by: jesus m. rodriguez <jmrodri@gmail.com>
Co-authored-by: Eric Stroczynski <ericstroczynski@gmail.com>
  • Loading branch information
jmrodri and estroz authored Apr 22, 2022
1 parent df06f4b commit 95237b3
Show file tree
Hide file tree
Showing 13 changed files with 628 additions and 377 deletions.
14 changes: 11 additions & 3 deletions internal/cmd/operator-sdk/bundle/validate/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ To validate a bundle against the validator for Good Practices specifically, in a
To validate a bundle against the (alpha) validator for Deprecated APIs specifically, in addition to required bundle validators:
$ operator-sdk bundle validate ./bundle --select-optional name=alpha-deprecated-apis --optional-values=k8s-version=1.22
$ operator-sdk bundle validate ./bundle --select-optional name=alpha-deprecated-apis --optional-values=k8s-version=1.22
To validate a bundle against an external validator, in addition to required bundle validators:
$ operator-sdk bundle validate ./bundle --alpha-select-external /path/to/external-validator[:/path/to/optional-second-validator]
`
)

Expand Down Expand Up @@ -139,11 +143,15 @@ func NewCmd() *cobra.Command {
if err != nil {
logger.Fatal(err)
}
if err := result.PrintWithFormat(c.outputFormat); err != nil {
failed, err := result.PrintWithFormat(c.outputFormat)
if err != nil {
logger.Fatal(err)
}

logger.Info("All validation tests have completed successfully")
// if a test failed don't print that it was successful
if !failed {
logger.Info("All validation tests have completed successfully")
}

return nil
},
Expand Down
288 changes: 0 additions & 288 deletions internal/cmd/operator-sdk/bundle/validate/internal/result_test.go

This file was deleted.

Loading

0 comments on commit 95237b3

Please sign in to comment.