mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
feat(compliance): Add JSON output option
This adds a new --json flag to the compliance subcommand, which will output the compliance test results as minified JSON to stdout. Also a few other small additions: - Exit 1 if compliance tests fail - Use random port for test server using freeport library (added) Signed-off-by: Josh Dolitsky <393494+jdolitsky@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/anuvu/zot/errors"
|
||||
@@ -102,6 +103,9 @@ func NewRootCmd() *cobra.Command {
|
||||
default:
|
||||
v1_0_0.CheckWorkflows(t, complianceConfig)
|
||||
}
|
||||
if t.Failed() {
|
||||
os.Exit(1)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -121,6 +125,8 @@ func NewRootCmd() *cobra.Command {
|
||||
|
||||
complianceCmd.Flags().StringVarP(&complianceConfig.Version, "version", "V", "all",
|
||||
"OCI dist-spec version to check")
|
||||
complianceCmd.Flags().BoolVarP(&complianceConfig.OutputJSON, "json", "j", false,
|
||||
"output test results as JSON")
|
||||
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "zot",
|
||||
|
||||
Reference in New Issue
Block a user