Yaml condition using searchpattern should pass if at least one file was detected · Issue #9848 · updatecli/updatecli · GitHub
Skip to content

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

Closed

Description

@olblak

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Currently a yaml condition using searchpattern fails if at least one yaml couldn't detect the specified key.
To align with the file plugin, we should only fail if none of the yaml file contain the specified key.

The goal would be to use this condition in pipelines like

conditions:
  githubaction:
    name: "Is Updatecli is used in a GitHub Action workflow"
    kind: yaml
    spec:
      engine: yamlpath
      files:
        - ".github/workflows/*"
      key: '$.jobs.*.steps[?(@.uses =~ /^updatecli\/updatecli-action/)].with.version'
      keyonly: true
      searchpattern: true
    # {{ if .scm.enabled }}
    scmid: default

From https://github.com/updatecli/policies/pull/217/changes

Expected Behavior

The goal would be to use this condition in pipelines like

conditions:
  githubaction:
    name: "Is Updatecli is used in a GitHub Action workflow"
    kind: yaml
    spec:
      engine: yamlpath
      files:
        - ".github/workflows/*"
      key: '$.jobs.*.steps[?(@.uses =~ /^updatecli\/updatecli-action/)].with.version'
      keyonly: true
      searchpattern: true
    # {{ if .scm.enabled }}
    scmid: default

From https://github.com/updatecli/policies/pull/217/changes

Steps To Reproduce

No response

Environment

- OS:linux
- updatecli: v0.119.0

Pipeline Graph

OpenTelemetry Trace

No response

Anything else?

No response

Activity

  1. added this to the 1.0.0 milestone on Aug 5, 2026
  2. junnhwan commented on Aug 6, 2026

    @junnhwan
    Contributor

    Hi @olblak, I'd like to work on this issue.

    I plan to align the yaml condition behavior with the file plugin: when \searchpattern: true\ and \keyonly: true\ are used, the condition should pass as long as at least one matched file contains the specified key, and only fail if none of the yaml files contain the key.

    I'll update \pkg/plugins/resources/yaml/condition.go\ and add test cases covering both scenarios. Could you assign the issue to me?

  3. olblak commented on Aug 7, 2026

    @olblak
    MemberAuthor

    This would be awesome thanks

  4. added a commit that references this issue on Aug 12, 2026
    08c2846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions