Skip to content

Commit 95237b3

Browse files
jmrodriestroz
andauthored
Add support for external bundle validators (#5525)
* 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 <[email protected]> Co-authored-by: Eric Stroczynski <[email protected]>
1 parent df06f4b commit 95237b3

File tree

13 files changed

+628
-377
lines changed

13 files changed

+628
-377
lines changed

internal/cmd/operator-sdk/bundle/validate/cmd.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ To validate a bundle against the validator for Good Practices specifically, in a
9595
9696
To validate a bundle against the (alpha) validator for Deprecated APIs specifically, in addition to required bundle validators:
9797
98-
$ operator-sdk bundle validate ./bundle --select-optional name=alpha-deprecated-apis --optional-values=k8s-version=1.22
98+
$ operator-sdk bundle validate ./bundle --select-optional name=alpha-deprecated-apis --optional-values=k8s-version=1.22
99+
100+
To validate a bundle against an external validator, in addition to required bundle validators:
101+
102+
$ operator-sdk bundle validate ./bundle --alpha-select-external /path/to/external-validator[:/path/to/optional-second-validator]
99103
`
100104
)
101105

@@ -139,11 +143,15 @@ func NewCmd() *cobra.Command {
139143
if err != nil {
140144
logger.Fatal(err)
141145
}
142-
if err := result.PrintWithFormat(c.outputFormat); err != nil {
146+
failed, err := result.PrintWithFormat(c.outputFormat)
147+
if err != nil {
143148
logger.Fatal(err)
144149
}
145150

146-
logger.Info("All validation tests have completed successfully")
151+
// if a test failed don't print that it was successful
152+
if !failed {
153+
logger.Info("All validation tests have completed successfully")
154+
}
147155

148156
return nil
149157
},

internal/cmd/operator-sdk/bundle/validate/internal/result_test.go

Lines changed: 0 additions & 288 deletions
This file was deleted.

0 commit comments

Comments
 (0)