validator

package
v0.0.0-...-be7f909 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 33

Documentation

Overview

Package validator checks that project configuration files and distro settings are correct.

Index

Constants

View Source
const (
	Error ValidationErrorLevel = iota
	Warning
	Notice
	EC2HostCreateTotalLimit    = 1000
	DockerHostCreateTotalLimit = 200
	HostCreateLimitPerTask     = 3
)

Variables

This section is empty.

Functions

func CheckProjectConfigurationIsValid

func CheckProjectConfigurationIsValid(ctx context.Context, settings *evergreen.Settings, project *model.Project, pref *model.ProjectRef) error

CheckProjectConfigurationIsValid checks if the project configuration has errors

func ValidationErrorsToString

func ValidationErrorsToString(ves ValidationErrors) string

Types

type ValidationError

type ValidationError struct {
	Level   ValidationErrorLevel `json:"level"`
	Message string               `json:"message"`
}

func (ValidationError) Error

func (vr ValidationError) Error() string

type ValidationErrorLevel

type ValidationErrorLevel int64

func (ValidationErrorLevel) String

func (vel ValidationErrorLevel) String() string

type ValidationErrors

type ValidationErrors []ValidationError

func CheckAliasWarnings

func CheckAliasWarnings(project *model.Project, aliases model.ProjectAliases) ValidationErrors

CheckAliasWarnings returns warnings related to the definition of tasks/variants matching the given aliases.

func CheckDistro

func CheckDistro(ctx context.Context, d *distro.Distro, s *evergreen.Settings, newDistro bool) (ValidationErrors, error)

CheckDistro checks if the distro configuration syntax is valid. Returns a slice of any validation errors found.

func CheckPatchedProjectConfigErrors

func CheckPatchedProjectConfigErrors(patchedProjectConfig string) ValidationErrors

CheckPatchedProjectConfigErrors returns validation errors for the given patched project config.

func CheckProject

func CheckProject(ctx context.Context, project *model.Project, config *model.ProjectConfig, ref *model.ProjectRef, includeLong bool, projectRefId string, projectRefErr error) ValidationErrors

CheckProject calls the validating logic for a Project's configuration. That is, ProjectErrors, ProjectWarnings, ProjectConfigErrors, ProjectSettings, and AliasWarnings. If a respective item is nil, it will not check it (e.g. if the config is nil, it does not check the config). projectRefId is used to determine if there is a project specified and projectRefErr is used to determine if there was a problem retrieving the ref; both output different warnings for the project.

func CheckProjectConfigErrors

func CheckProjectConfigErrors(projectConfig *model.ProjectConfig) ValidationErrors

CheckProjectConfigErrors verifies that the project configuration syntax is valid

func CheckProjectErrors

func CheckProjectErrors(ctx context.Context, project *model.Project, includeLong bool) ValidationErrors

CheckProjectErrors returns errors about the project configuration syntax

func CheckProjectSettings

func CheckProjectSettings(ctx context.Context, settings *evergreen.Settings, p *model.Project, ref *model.ProjectRef, isConfigDefined bool) ValidationErrors

CheckProjectSettings checks the project configuration against the project settings.

func CheckProjectWarnings

func CheckProjectWarnings(project *model.Project) ValidationErrors

CheckProjectWarnings returns warnings about the project configuration semantics

func (ValidationErrors) Annotate

func (v ValidationErrors) Annotate(key string, value interface{}) error

func (ValidationErrors) AtLevel

AtLevel returns all validation errors that match the given level.

func (ValidationErrors) Has

Has returns if any of the errors are at the given level.

func (ValidationErrors) Loggable

func (v ValidationErrors) Loggable() bool

func (ValidationErrors) Priority

func (v ValidationErrors) Priority() level.Priority

func (ValidationErrors) Raw

func (v ValidationErrors) Raw() interface{}

func (ValidationErrors) SetPriority

func (v ValidationErrors) SetPriority(_ level.Priority) error

func (ValidationErrors) String

func (v ValidationErrors) String() string

type ValidationInput

type ValidationInput struct {
	ProjectYaml []byte `json:"project_yaml" yaml:"project_yaml"`
	Quiet       bool   `json:"quiet" yaml:"quiet"`
	IncludeLong bool   `json:"include_long" yaml:"include_long"`
	ProjectID   string `json:"project_id" yaml:"project_id"`
}

Jump to

Keyboard shortcuts

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