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

Trigger * pattern only matches non-slash characters #691

Open
michaelsauter opened this issue May 12, 2023 · 2 comments · May be fixed by #745
Open

Trigger * pattern only matches non-slash characters #691

michaelsauter opened this issue May 12, 2023 · 2 comments · May be fixed by #745
Labels
question Further information is requested

Comments

@michaelsauter
Copy link
Member

path.Match does not match e.g. feature/foo when the pattern is just *. If users want to match strings with slashes, they must specify the pattern */* as well. For example, to match all branches, one must write branches: ["*", "*/*"]. This could trip up users who might expect * to match everything (as I just did).

Should we special-case "*" to be a catch-all? Or change the whole matching behaviour? Or leave as is?

This was detected as part of #690, which does nothing about it except calling it out in the docs.

@michaelsauter michaelsauter added the question Further information is requested label May 12, 2023
@henninggross
Copy link
Member

During some migration work, I have noticed that all config files were indeed using "*" instead of "*", "*/*" and my assumption is that the maintainers of those config files intended to match all branches (including feature/foo).
To me it'd be more intuitive to make "*" a catch-all, even if it means special-casing it. It can easily be overlooked in the docs and cause confusion if pipelines are not triggered as one would expect when setting "*".

@michaelsauter michaelsauter linked a pull request Nov 17, 2023 that will close this issue
4 tasks
@michaelsauter
Copy link
Member Author

I opened #745, which addresses this.

While reading the code I realised that another way to express "match all", that currently already exists, is to simply do not specify anything. Example:

pipelines:
- triggers:
  - branches: ["main"]
    params:
    - { name: start.artifact-source, value: "my-nexus-repo" }
    - { name: deploy.namespace, value: "prod-env" }
  tasks:
  - name: deploy
- triggers:
  - params:
    - { name: finish.artifact-target, value: "my-nexus-repo" }
    - { name: deploy.namespace, value: "prod-env" }
    - { name: deploy.diff-only, value: "true" }
  tasks:
  - name: build
  - name: package
  - name: deploy

The second pipeline will be triggered for any branch.

@henrjk @henninggross Let me know if you'd still would continue with PR #745 or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants