Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to filter errors in packages based on codes #1467

Merged
merged 24 commits into from
Oct 2, 2023

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Sep 22, 2023

Relates elastic/package-spec#558

This PR adds the required support to filter errors based on the errors configuration (errors.yml validation.yml) for both directories and zip packages.

This PR depends on a new package-spec version including the structured errors.

@mrodm mrodm force-pushed the add_filter_errors_packages branch from 3bd1eeb to 246577f Compare September 26, 2023 09:00
@mrodm mrodm changed the title Add filter errors packages Add support to filter errors in packages based on codes Sep 26, 2023
@mrodm mrodm self-assigned this Sep 26, 2023
@mrodm mrodm requested a review from a team September 26, 2023 17:32
@mrodm mrodm marked this pull request as ready for review September 26, 2023 17:32
@mrodm
Copy link
Contributor Author

mrodm commented Sep 26, 2023

buildkite test this

1 similar comment
@mrodm
Copy link
Contributor Author

mrodm commented Sep 27, 2023

buildkite test this

cmd/lint.go Outdated
return fmt.Errorf("linting package failed: %w", err)
errs, skipped := validation.ValidateAndFilterFromPath(packageRootPath)
if skipped != nil {
logger.Infof("skipped errors: %v", skipped)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log these at the warning level instead?

cmd/lint.go Outdated Show resolved Hide resolved
internal/builder/packages.go Outdated Show resolved Hide resolved
internal/builder/packages.go Outdated Show resolved Hide resolved
internal/packages/installer/factory.go Outdated Show resolved Hide resolved
internal/validation/validation.go Outdated Show resolved Hide resolved
return allErrors, nil, nil
}

config, err := processors.LoadConfigFilter(fsys, configPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still see this "processors" name as a too generic name, specially when used externally, but lets continue with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just changed all the code in processors to be in the same specerrors.

Copy link
Collaborator

@jlind23 jlind23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@@ -0,0 +1,45 @@
# HOWTO: Filter errors based on Validation Codes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added doc about how filtering errors should be set up.

@mrodm
Copy link
Contributor Author

mrodm commented Sep 29, 2023

Updated with the latest package-spec version and added a new doc about how to filter errors based on the codes.

@mrodm mrodm requested review from jsoriano and jlind23 September 29, 2023 15:57
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it! ⛵

@mrodm mrodm merged commit 9d8ce35 into elastic:main Oct 2, 2023
1 check passed
@mrodm mrodm deleted the add_filter_errors_packages branch October 2, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants