Open jimsheldon opened 1 year ago
I think we need logic that can handle wildcards.
For example, we can have a drone condition like this:
- name: example
image: alpine
commands: echo example
when:
branch:
- example-*
To do this in JEXL, we need to use =~
like this:
<+trigger.branch> =~ "example-.*"
But a drone pipeline like this:
- name: example
image: alpine
commands: echo example
when:
branch:
- example
Would use JEXL like this:
<+trigger.branch> == "example"
Improved JEXL conditions in #81
For Drone, we would be trying to replicate the behavior of the doublestar library.
Drone uses the drone-yaml library for yaml parsing https://github.com/harness/drone/blob/master/go.mod#L18
drone-yaml uses an old version 1.1.1
https://github.com/drone/drone-yaml/blob/master/go.mod#L6C31-L6C31
This is a relatively small library with less than 500 lines of code https://github.com/bmatcuk/doublestar/blob/v1.1.1/doublestar.go
Perhaps we can use this logic in the conversion.
Some of the downgrade condition/trigger logic is wrong.
For example,
<+codebase.commitRef> =~ "refs/heads/master"
is not valid, it should be<+codebase.commitRef> == "refs/heads/master"
.We need to investigate the correct condition and trigger logic.