Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Support all glob path patterns #136

Open
cycraig opened this issue Sep 26, 2023 · 2 comments
Open

Support all glob path patterns #136

cycraig opened this issue Sep 26, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@cycraig
Copy link

cycraig commented Sep 26, 2023

Description

Only * and ** work when used in a path trigger. It would be nice to use curly braces too.

Curly brace patterns are supported by doublestar (the library used for */** in this repo), and actually work currently, but only if the path includes * too.

Example

steps:
  - label: "Triggering pipelines with glob paths"
    plugins:
      - monebag/monorepo-diff#v2.5.9:
          diff: "git diff --name-only HEAD~1"
          watch:
            - path:
                - "rust/**/*.{rs,toml,lock}" # works
                - "rust/{foo,bar}/*.{rs,sql}" # works
                - "scripts/{git-diff,install-rust}.sh" # fails, no trigger
              config:
                command: "cargo check"

Suggestion

I believe this is the relevant code? Maybe it's sufficient to check for pairs of brackets too?

This is probably a breaking change, since existing path triggers containing brackets {}/[] might behave differently (if those paths don't contain *).

https://github.com/monebag/monorepo-diff-buildkite-plugin/blob/3f65d099261bf9680da137cc4cabc363bcabcb8d/pipeline.go#L120-L125

@adikari
Copy link
Owner

adikari commented Sep 28, 2023

I will have a look into this at some point. For now is it enough to add 2 entries for the one that is not working?

 - path:
                - "rust/**/*.{rs,toml,lock}" # works
                - "rust/{foo,bar}/*.{rs,sql}" # works
                - "scripts/install-rust.sh" 
                - "scripts/git-diff.sh" 

@adikari adikari self-assigned this Sep 28, 2023
@adikari adikari added the enhancement New feature or request label Sep 28, 2023
@cycraig
Copy link
Author

cycraig commented Sep 28, 2023

For now is it enough to add 2 entries for the one that is not working?

Absolutely. ^^

I think only less common glob patterns like exclusions (e.g. [!asdf]) would not have an easy workaround, but those aren't very useful for path matching here anyway.

No rush on this, it was just unexpected that glob patterns only work if * is included too. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants