-
Notifications
You must be signed in to change notification settings - Fork 44
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
Handle fancy wildcard branch patterns #49
Conversation
These are "matching" fixtures. Left is the pattern, right is the branch. All return "yes, it's a match" # empty branch names
[ "foo", nil ],
[ "", nil ],
[ " ", nil ],
# empty branch configs
[ nil, "foo" ],
[ nil, "" ],
[ nil, " " ],
# single name branch matches
[ "foo bar", "foo" ],
[ "foo bar", "bar" ],
# with whitespace
[ " master ", "master" ],
[ "master ", "master" ],
[ " master", "master" ],
# ones with a slash
[ "feature/authentication", "feature/authentication" ],
# not-checking
[ "!foo", "master" ],
[ "!release/production !release/test", "master" ],
# prefix wildcards
[ "*-do-the-thing", "can-you-do-the-thing" ],
[ "!*-do-the-thing", "can-you-do-the-thing-please" ],
# wildcards
[ "release/*", "release/foo" ],
[ "release/*", "release/bar/bing" ],
[ "release-*", "release-thingy" ],
[ "release-* release/*", "release-thingy" ],
[ "release-* release/*", "release/thingy" ],
[ "this-*-thing-is-the-*", "this-ruby-thing-is-the-worst" ],
[ "this-*-thing-is-the-*", "this-regex-thing-is-the-best" ],
[ "this-*-thing-is-the-*", "this-*-thing-is-the-*" ],
[ "this-*-thing-is-the-*", "this--thing-is-the-best-" ], Here's are the ones that return # branch names
[ "foo bar", "bang" ],
# not-matchers
[ "!foo bar", "foo" ],
[ "!release/*", "release/foo" ],
[ "!release/*", "release/bar" ],
[ "!refs/tags/*", "refs/tags/production" ],
[ "!release/production !release/test", "release/production" ],
[ "!release/production !release/test", "release/test" ],
# ones with a slash
[ "feature/authentication", "update/deployment" ],
# wildcards
[ "release-*", "release/thingy" ],
[ "release-*", "master" ],
[ "*-do-the-thing", "this-is-not-the-thing" ], |
Feel free to pilfer the data and add them into the test suite! |
local/pipeline.go
Outdated
if branches != nil { | ||
// Sometimes branches are space delimited, sometimes comma |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BK backend doesn't support branches: "foo, bar"
- is that what this bit is for? Or is this something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok cool, not sure where I got that from, but will ditch it.
Mind reviewing where I got up to when you get a minute @keithpitt? |
Gonna yolo merge this. |
Thanks @lox! |
Based on feedback in https://forum.buildkite.community/t/cli-steps-dont-run-when-there-is-a-negated-branch-filter/400/5, this adds support for different branch filter patterns.
@keithpitt I'd love some feedback on what the actual types of patterns that are supported are 😅