Is there a way to have a Webhook fire whenever a branch is updated in Git/Gitlab?
I am trying to set up a Development Workflow. The original idea was to have a repository for each coding phase - ex: a repository for development, a repository for testing, a repository for production.
The thing is, I need for actions to take place once the Master branch changes. For example, if the Development repository is updated, the Development code is to be "cloned", a .exe file is generated and the file is then placed into a "Development" directory for testing purposes.
Ideally, once development goes well, you "promote" the code to "testing". If "testing" goes well, you then promote the code to "production".
The problem is that there is no way to "promote" code between repositories. The only thing available is being able to merge a lower branch with a higher one.
All of the examples I have seen refer to development branches, test branches and a "production" branch is actually the master branch of the repository.
OK - I can accept this; however, in this case, I would need to compile development code based on the development branch, test code based on the test branch, etc.
For this to take place, a Webhook needs to fire so that appropriate actions can be taken to do the tasks above (hence the reason for asking my question).
So - once more - how can one get a Webhook to fire when a particular ~branch~ changes in the repository?
how can one get a Webhook to fire when a particular ~branch~ changes in the repository?
That looks like issues 1176
If you look at the posted data, you have
:ref => "refs/heads/master",
Webhooks works sending a POST request to a script, with a payload describing the push.
You need a service listening to that webhook though.
If you use a Jenkins server, you can have a Jenkins GitLab plugin "branch filtering" for your webhook to point to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With