dancryer / PHPCI

PHPCI is a free and open source continuous integration tool specifically designed for PHP.
BSD 2-Clause "Simplified" License
2.42k stars 441 forks source link

Webhook observe configured branches #1333

Closed phizzl closed 1 year ago

phizzl commented 7 years ago

Contribution Type: new feature

This pull request affects the following areas:

In raising this pull request, I confirm the following (please check boxes):

Detailed description of change:

When working with GIT webhooks every commit of every contributor triggers a build in PHPCI. As I have very time consuming acceptance tests with Codeception and my contributors are pushing a lot of stuff PHPCI is always very busy. For me there is no need to run all tests for every commit on every branch. Important for me is my master branch and my release candidate branches where I put all branches of my contributors together to see if it works. So I've added a textarea with the name "observed_branches" to the project configuration page. Before a build is triggered via webhook by WebhookController::createBuild I check if the requestet branch is in the projects branch observation by getting the text from "observed_branches" and exploding it by PHP_EOL. After that I'll check if the branch name submitted by the webhook is in my exploded array. If not I will not create the build. If the project option "observed_branches" is empty all incoming branch names are triggering a build creation as it is now. You may also use the * sign as a wildcard for branch names when configuring the "observed_branches" option, as I use this for my RC branches. For example a configuration like

master
rc-*

would accept a build creation via webhook for the "master" branch and all branch names starting with "rc-"

Maybe this can be helpful to others.

branchobservation branchobservationwebhookignored