Extended glob patterns?

Hello!

We have a trigger configured for the master branch and version branches, like so:

trigger:
  branch:
  - master
  - v+([0-9]).+([0-9])

This works perfectly if tested outside drone (for example, here). However, drone does not seem to acknowledge it. Is this extended glob pattern supported? We do not observe any triggered builds if branch name is, for example, 0.999.

Thanks!

Drone uses the following package for glob support:

Drone therefore supports any glob syntax that is supported by this library. I cannot speak to the full syntax supported by this library, so you would need to research the package documentation to gain a better understanding of the full syntax.

The library is extremely limited and at this moment we can support only conditions which match tags with numbers in range 0-9. Example: refs/tags/0.0.1-rc1

  when:
    ref:
    - refs/heads/master
    - refs/tags/[0-9].[0-9].[0-9]-* #clear limitation which needs to be worked out

What is challenge here is to support refs/tags/12.0.12-rc1 but with current glob support I’ll say it is not possible (my mastery of the glob patterns can be the issue as well :slight_smile: )

So this glob refs/tags/[0-9].[0-9].[0-9]-* works for refs/tags/0.0.1-* but not for refs/tags/0.0.12-*

If we have support for full(extended) glob or regex syntax it will be possible to have refs/tags/+([0-9]).+([0-9]).+([0-9])-* and cover both cases.

regex is not an option because it would have the potential to introduce breaking changes. one options is to create a custom extension that uses regex, which would be opt-in https://docs.drone.io/extensions/conversion/

another option would be to work with the Go team to improve the match / glob functionality in their standard library, on which this code is based:
https://golang.org/pkg/path/filepath/#Match

I’m not sure that conversion plugin will help as I don’t see possibllity to write glob pattern which will support what I’ve described with aforementioned Go library.

I’m not sure that conversion plugin will help as I don’t see possibllity to write glob pattern which will support what I’ve described with aforementioned Go library.

see the paths changed extension:

they added their own conditional logic to the yaml. Similarly, you could add your own conditional logic to the yaml that uses regex to evaluate whether or not to execute the step.