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

YAML plugin supports YAMLPath #1333

Merged
merged 28 commits into from
May 25, 2023
Merged

YAML plugin supports YAMLPath #1333

merged 28 commits into from
May 25, 2023

Conversation

olblak
Copy link
Member

@olblak olblak commented May 17, 2023

The initial yaml plugin implementation relied on "go-yaml/yaml" to provide a very limited version of yamlpath
After some quick testing it appears that goccy implementation solves many limitation of "go-yaml/yaml"

Fix #522
Fix #1028
Fix #903

requirements

  • Validate autodiscovery generate manifest with the correct yamlpath syntax

Test

To test this pull request, you can run the following commands:

cp pkg/plugins/resources/yaml/
go test

Additional Information

Tradeoff

So far the initial identified two tradeoff

  1. Yamlpath key are expected to start with '$.', so for now I am displaying a warning message and automatically add the prefix "$."
  2. In the current custom implement, dots could be escaped such as annotation.github\.owner, now the key containing dot should be escaped such as annotation.'github.owner'

Potential improvement

Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added bug Something isn't working resource-yaml Resource of kind YAML labels May 17, 2023
@olblak olblak marked this pull request as draft May 17, 2023 20:55
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak changed the title Switch yaml resource to goccy/go-yaml YAML plugin supports YAMLPath May 18, 2023
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak marked this pull request as ready for review May 18, 2023 18:56
olblak and others added 11 commits May 18, 2023 21:07
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added this to the 0.51.0 milestone May 21, 2023
Signed-off-by: Olblak <me@olblak.com>
indent is not used anymore as the plugin can now automatically detect
the right indentation.

Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@dduportal
Copy link
Contributor

Additional value of this PR should avoid unexppected parsing behavior when an unicode character (such as an emoji) is present in yaml value (ref. jenkins-infra/kubernetes-management#3977).

@olblak olblak removed the bug Something isn't working label May 25, 2023
@olblak olblak merged commit 07b989d into updatecli:main May 25, 2023
6 checks passed
@olblak olblak deleted the yamlRefactor branch May 25, 2023 20:23
@olblak olblak added the enhancement New feature or request label May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request resource-yaml Resource of kind YAML
Projects
None yet
2 participants