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

fix(yaml): pass keyonly condition with searchpattern when at least one file matches#9889
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

Hi @olblak, this is my first contribution to updatecli, so the CI workflows (Go, CodeQL, typos, zizmor, Updatecli Test) are waiting for approval before they can run. Could you approve them when you have a moment? Thanks!

@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

Hi @olblak, quick heads-up on the failing updatecli check: the failure looks like an infrastructure issue rather than a regression from this PR. The failing pipelines are chore(node): upgrade node version and docs: bump updatecli version, both failing on parent source "..." failed (external source lookup), and the same check is also failing on main (e.g. commit 9110b1d: "Updatecli - monitored pipelines" failed, "Updatecli - existing pipelines" cancelled) and on other open dependency PRs.

The Go build, Analyse, CodeQL, typos and zizmor checks all pass on this PR. Happy to rebase or help in any way if needed.

@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