buildkite / feedback

Got feedback? Please let us know!
https://buildkite.com
25 stars 24 forks source link

Only trigger builds on tagged commits #299

Closed cwalo closed 6 years ago

cwalo commented 6 years ago

We'd like to only trigger builds by pushing a tagged commit. Currently, it looks like our only options are to use [skip ci] for every other commit or just use the buildkite API with some other github webhook. Do I have that right?

-Corey

ticky commented 6 years ago

You can achieve this by setting a branch filter with an extremely unlikely branch name (like, say, please/dont/build/anything), which will mean that we build nothing based on push. Then under your repository provider settings (GitHub, GitLab, etc.) configuring it to only build tags, so you’d end up with a configuration like this:

screen shot 2017-11-28 at 11 26 24 am

The reason this works is that builds triggered from Pull Requests or Tags ignore the global branch filter and operate with their own configuration!

I hope we can make this sort of setup simpler in the future. 😄

cwalo commented 6 years ago

@ticky Ah, a little hacky, but good enough for now! Thanks!

liyanone1990 commented 6 years ago

Hi, may I know how to configure building on pushed tag on gitlab repo? There is no gitlab settings section on buildkite pipeline settings. After I enable the webhook with gitlab and select Tag push events trigger, no matter I create tag on gitlab or git push tag remotely, it actually nothing happened on buildkite.

PJHaynes304 commented 6 years ago

"The reason this works is that builds triggered from Pull Requests or Tags ignore the global branch filter and operate with their own configuration!"

@ticky is this still the case? After setting a branch filter and configuring to build tags as suggested no builds are triggered when I push a tag up...

The reason I ask is that the Build pull requests configuration has a comment saying pipeline-level branch filtering is ignored but the Build tags configuration does not. screen shot 2018-08-22 at 10 45 14

oj22 commented 4 years ago

@ticky - I am unable to find the setting in Github. which you have mentioned.can you please help to find out

keithpitt commented 4 years ago

@oj22 👋 ah sorry, the setting is in Buildkite - not GitHub.

In Buildkite, go to your Pipeline Settings:

image

Then the GitHub Settings:

image

You'll see the option in here:

image

mskonovalov commented 4 years ago

It doesn't seem to work anymore (at least in my setup). If on GH webhook you choose to send only Branch or tag creation event it doesn't trigger the build. So if you add event Pushes in GH webhook it starts. But it treats tag same way as branch, so specifically wrong branch name doesn't work anymore. So you can solve this by naming tags like release-x.y.z and setting branch filter pattern to release-* or something similar