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

Use regex for branch white-list in yaml #713

Closed
donny-dont opened this issue Nov 18, 2014 · 6 comments
Closed

Use regex for branch white-list in yaml #713

donny-dont opened this issue Nov 18, 2014 · 6 comments
Milestone

Comments

@donny-dont
Copy link

Currently the include exclude for branches is an all or nothing scenario.

It would be nice to be able to do something like

branches:
  include:
    - master
    - release*
@bradrydzewski
Copy link

We can re-purpose the filepath.Match function for this. The double-bonus is that many projects use filepath separators in the branch names.

fmt.Println(filepath.Match("test-*", "test-a")) // true
fmt.Println(filepath.Match("test-*", "test"))   // false
fmt.Println(filepath.Match("test/*", "test/a")) // true

bradrydzewski added a commit to bradrydzewski/drone that referenced this issue Nov 18, 2014
bradrydzewski added a commit that referenced this issue Nov 18, 2014
fix for #713, match branches with wildcard
@bradrydzewski bradrydzewski reopened this Nov 21, 2014
@bradrydzewski
Copy link

sorry, re-opening this because I realized I added wildcard capabilities to the deployment / publish section, and not the branches section that you referenced in your original issue description.

@stevenpall
Copy link

@bradrydzewski Any update on this functionality?

@bradrydzewski bradrydzewski changed the title Allow wildcards for include/exclude branches Use regex for branch white-list in yaml Aug 18, 2015
@bradrydzewski bradrydzewski added this to the v0.4.1 milestone Aug 18, 2015
@bradrydzewski
Copy link

we have a pretty solid implementation in the 0.4 branch. This needs to be documented, including the new negation syntax we added before closing this issue (reminder to me)

@pgaubatz
Copy link

Hi!

I was wondering what happened to this issue...
It would be great to only trigger a deploy task when the current branch matches a certain regex (e.g., /^v?[0-9]+\.[0-9]+\.[0-9]+.*$/).
The documentation (http:https://readme.drone.io/) doesn't mention it, but is something like this already possible?

Thanks in advance and thanks for drone! I love it! 👍

Cheers,
Patrick

@bradrydzewski
Copy link

bradrydzewski commented Apr 16, 2016

I'm marking this as closed since we now have pattern matching and include and exclude sections. See unit tests for more examples:
https://github.com/drone/drone/blob/master/engine/parser/branch_test.go

This is an example of all the different variations:

branch: master
branch: [ master, release/*]
branch:
  include: master
branch:
  include: [ master, release/* ]
branch:
  exclude: feature/*

If anyone wants something more complex than this I am willing to accept pull requests that maintain backward compatibility and include unit tests :)

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

No branches or pull requests

4 participants