-
Notifications
You must be signed in to change notification settings - Fork 71
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
aucoalesce - Fix yaml.v3 upgrade issues #170
Open
andrewkroh
wants to merge
5
commits into
elastic:main
Choose a base branch
from
andrewkroh:bugfix/normalizations-yaml-v3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
andrewkroh
added a commit
to andrewkroh/beats
that referenced
this pull request
Nov 8, 2024
andrewkroh
changed the title
Bugfix/normalizations yaml v3
aucoalesce - Fix yaml.v3 upgrade issues
Nov 8, 2024
andrewkroh
added a commit
to andrewkroh/beats
that referenced
this pull request
Nov 8, 2024
andrewkroh
added a commit
to andrewkroh/beats
that referenced
this pull request
Nov 8, 2024
This test passes under v2.5.0, but fails under v2.6.0.
The yaml.Unmarshaler interface changed between yaml.v2 and yaml.v3. But our implementations were not updated during the upgrade process. This adds compile time checks to ensure that yaml.Unmarshaler is implemented.
Under yaml.v3 the anchors with objects do not perform a deep merge. https://yaml.org/type/merge.html > Keys in mapping nodes earlier in the sequence override keys specified in later mapping nodes. Given the following, it was previously expected that the second entry would merge to create {object: {primary: foo, secondary: bar}}, but that does not happen under v3. - &my_macro object: primary: foo - <<: *my_macro object: secondary: bar To address this, instead of using objects this change flattens the structure The changes to normalizations.yaml were aided by https://gist.github.com/andrewkroh/e7212a1ff033a0227f7c8d3fa7df8973.
Ensure that all fields in normalizition.yaml are defined in a struct to avoid typos.
andrewkroh
force-pushed
the
bugfix/normalizations-yaml-v3
branch
from
November 8, 2024 21:39
1f9d4d9
to
52e8126
Compare
💚 Build Succeeded
History |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #169 to fix bugs introduced during the upgrade from
yaml.v2
toyaml.v3
.Add failing test case: A test case has been added to highlight a regression where a test passes under
yaml.v2
but fails underyaml.v3
.Update
yaml.v3
Unmarshaler implementation: Theyaml.Unmarshaler
interface changed betweenyaml.v2
andyaml.v3
, but the implementation was not updated accordingly. This commit ensures that theyaml.Unmarshaler
interface is correctly implemented and adds compile-time checks to ensure proper interface adherence.Flatten keys in
normalizations.yaml
to avoid deep merge issues: Underyaml.v3
, anchors with objects do not perform a deep merge as expected in previous versions. To address this, the structure innormalizations.yaml
has been flattened, replacing the object-based merging with a flatter structure. This ensures the expected behavior where keys in later nodes override keys from earlier ones. The flattening ofnormalizations.yaml
was aided by https://gist.github.com/andrewkroh/e7212a1ff033a0227f7c8d3fa7df8973 (white space changes were manually reverted).Enable strict YAML decoding: This change enforces strict decoding of
normalizations.yaml
to ensure all fields are explicitly defined in the corresponding struct. This helps catch potential typos or undefined fields.