Documentation
¶
Overview ¶
Package validator checks that project configuration files and distro settings are correct.
Index ¶
- Constants
- func CheckProjectConfigurationIsValid(ctx context.Context, settings *evergreen.Settings, project *model.Project, ...) error
- func GetAllowedSingleTaskDistroTasksForProject(ctx context.Context, identifier string, settings *evergreen.Settings) (evergreen.ProjectTasksPair, error)
- func ValidationErrorsToString(ves ValidationErrors) string
- type TagValidationFailure
- type ValidationError
- type ValidationErrorLevel
- type ValidationErrors
- func CheckAliasWarnings(project *model.Project, aliases model.ProjectAliases) ValidationErrors
- func CheckDistro(ctx context.Context, d *distro.Distro, s *evergreen.Settings, newDistro bool) (ValidationErrors, error)
- func CheckPatchedProjectConfigErrors(ctx context.Context, patchedProjectConfig string) ValidationErrors
- func CheckProject(ctx context.Context, project *model.Project, config *model.ProjectConfig, ...) ValidationErrors
- func CheckProjectConfigErrors(ctx context.Context, projectConfig *model.ProjectConfig) ValidationErrors
- func CheckProjectErrors(ctx context.Context, project *model.Project) ValidationErrors
- func CheckProjectMixedValidations(project *model.Project) ValidationErrors
- func CheckProjectSettings(ctx context.Context, settings *evergreen.Settings, p *model.Project, ...) ValidationErrors
- func CheckProjectWarnings(project *model.Project) ValidationErrors
- func (v ValidationErrors) Annotate(key string, value any) error
- func (v ValidationErrors) AtLevel(level ValidationErrorLevel) ValidationErrors
- func (v ValidationErrors) Has(level ValidationErrorLevel) bool
- func (v ValidationErrors) Loggable() bool
- func (v ValidationErrors) Priority() level.Priority
- func (v ValidationErrors) Raw() any
- func (v ValidationErrors) SetPriority(_ level.Priority) error
- func (v ValidationErrors) String() string
- type ValidationInput
Constants ¶
const ( Error ValidationErrorLevel = iota Warning 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 GetAllowedSingleTaskDistroTasksForProject ¶
func GetAllowedSingleTaskDistroTasksForProject(ctx context.Context, identifier string, settings *evergreen.Settings) (evergreen.ProjectTasksPair, error)
GetAllowedSingleTaskDistroTasksForProject returns a struct with a list of tasks and bvs that is allowed for the given project and repo project. If both the project and repo project have allowed tasks/BVs, they are combined.
func ValidationErrorsToString ¶
func ValidationErrorsToString(ves ValidationErrors) string
Types ¶
type TagValidationFailure ¶
type TagValidationFailure struct {
// TaskName is the name of the task being added to build variants that fails
// tag validation.
TaskName string
// BuildVariants are the build variants where this task is used.
BuildVariants []string
}
TagValidationFailure describes a task being added to build variants by generate.tasks that doesn't have a tag with the required prefix.
func CheckGeneratedTaskTagValidation ¶
func CheckGeneratedTaskTagValidation(existing, merged *model.Project, prefix string) []TagValidationFailure
CheckGeneratedTaskTagValidation returns the tasks being added to build variants by generate.tasks whose tags do not match the tag validation prefix. Existing and merged are the translated project configurations before and after merging in the generated project configuration (i.e. a task/variant pair present only in merged was added by generate.tasks).
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(ctx context.Context, 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, 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(ctx context.Context, projectConfig *model.ProjectConfig) ValidationErrors
CheckProjectConfigErrors verifies that the project configuration syntax is valid
func CheckProjectErrors ¶
func CheckProjectErrors(ctx context.Context, project *model.Project) ValidationErrors
CheckProjectErrors returns errors about the project configuration syntax
func CheckProjectMixedValidations ¶
func CheckProjectMixedValidations(project *model.Project) ValidationErrors
CheckProjectMixedValidations returns validation errors about the project configuration that can be at any validation level.
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 and referential integrity.
func CheckProjectWarnings ¶
func CheckProjectWarnings(project *model.Project) ValidationErrors
CheckProjectWarnings returns warnings about the project configuration semantics
func (ValidationErrors) AtLevel ¶
func (v ValidationErrors) AtLevel(level ValidationErrorLevel) ValidationErrors
AtLevel returns all validation errors that match the given level.
func (ValidationErrors) Has ¶
func (v ValidationErrors) Has(level ValidationErrorLevel) bool
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() any
func (ValidationErrors) SetPriority ¶
func (v ValidationErrors) SetPriority(_ level.Priority) error
func (ValidationErrors) String ¶
func (v ValidationErrors) String() string