fix(yaml): pass keyonly condition with searchpattern when at least one file matches by junnhwan · Pull Request #9889 · updatecli/updatecli · GitHub
Skip to content

fix(yaml): pass keyonly condition with searchpattern when at least one file matches - #9889

Merged
olblak merged 4 commits into
updatecli:mainfrom
junnhwan:fix/yaml-condition-searchpattern-keyonly
Aug 12, 2026
Merged

olblak merged 4 commits into
updatecli:mainfrom
junnhwan:fix/yaml-condition-searchpattern-keyonly

Conversation

@junnhwan

@junnhwan junnhwan commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Fix #9848

When a yaml condition uses searchpattern: true together with keyonly: true, it should pass as long as at least one matched file contains the specified key, aligning with the file plugin behavior. Previously the condition failed whenever any matched file did not contain the key.

This change also records a per-file key miss for the yamlpath engine so the searchpattern handling can distinguish "at least one file contains the key" from "no file contains it".

Test

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

cd pkg/plugins/resources/yaml
go test

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

Tradeoff

Potential improvement

…e file matches

When a yaml condition uses searchpattern with keyonly, it should pass as
long as at least one matched file contains the specified key, aligning
with the file plugin behavior. Previously the condition failed whenever
any matched file did not contain the key.

Also record a per-file key miss for the yamlpath engine so the
searchpattern handling can distinguish 'at least one file contains the
key' from 'no file contains it'.

Closes updatecli#9848

Signed-off-by: Junhuan Zheng <3373484735@qq.com>
@junnhwan

junnhwan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@olblak olblak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this looks great, I'll need to find some time to test it

@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@junnhwan

junnhwan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@olblak olblak added bug Something isn't working resource-yaml Resource of kind YAML labels Aug 11, 2026

@olblak olblak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the pullrequest, tested manually and it works as expected

@olblak
olblak enabled auto-merge (squash) August 11, 2026 15:06
@olblak
olblak merged commit 08c2846 into updatecli:main Aug 12, 2026
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working resource-yaml Resource of kind YAML

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Yaml condition using searchpattern should pass if at least one file was detected

2 participants