validate

package
v1.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSONAlpha1Output = "json-alpha1"
	TextOutput       = "text"
)

Variables

This section is empty.

Functions

func GetExternalValidatorEntrypoints

func GetExternalValidatorEntrypoints(entrypoints string) ([]string, bool)

GetExternalValidatorEntrypoints returns a list of external validator entrypoints retrieved from given entrypoints string. If not set or set to the empty string, GetExternalValidatorEntrypoints returns false.

func RunExternalValidators

func RunExternalValidators(ctx context.Context, entrypoints []string, bundleRoot string) ([]apierrors.ManifestResult, error)

RunExternalValidators runs each entrypoint in entrypoint as a exec.Cmd with the single argument bundleRoot. External validators are expected to parse the bundle themselves with library APIs available in https://pkg.go.dev/github.com/operator-framework/api/pkg/manifests.

Types

type Output

type Output struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

Output represents the logs which are used to return the final result in the JSON format

type Result

type Result struct {
	Passed  bool     `json:"passed"`
	Outputs []Output `json:"outputs"`
}

Result represents the final result

func Combine

func Combine(results ...Result) (r Result, err error)

Combine creates a new Result and calls Result.Combine(results).

func NewResult

func NewResult() *Result

NewResult return a new result object which starts with passed == true since has no errors

func (*Result) AddError

func (r *Result) AddError(err error)

AddError will add a log to the result with the Error Level

func (*Result) AddInfo

func (r *Result) AddInfo(msg string)

AddInfo will add a log to the result with the Info Level

func (*Result) AddManifestResults

func (r *Result) AddManifestResults(results ...apierrors.ManifestResult)

AddManifestResults adds warnings and errors in results to Results.

func (*Result) AddWarn

func (r *Result) AddWarn(err error)

AddWarn will add a log to the result with the Warn Level

func (*Result) Combine

func (r *Result) Combine(results ...Result) error

Combine combines results into r, setting r.Passed = false if any Result in results has r.Passed == false.

func (*Result) PrintWithFormat

func (r *Result) PrintWithFormat(format string) (failed bool, err error)

PrintWithFormat prints output to w in format, and exits if some object in output is not in a passing state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL