One of the things that comes with google cloud are git repos. Is it possible to add hooks to this repo? I'd like to incoming pushes, but I don't know how to get access to .git/hooks
.
You can do it if you host your code on git-hub/bitbucket. Then you will be able to use the git hooks.
Google source has this feature (Object Change Notification) instead of hooks: https://cloud.google.com/storage/docs/object-change-notification
You can use the pub/sub notifications instead of the webhook.
In my case, I created a pub/sub which is triggered when the repository is updated. The pub/sub will call a cloud function that makes a post request to codemagic.io CI/CD to initiate a cloud build.
pub/sub notification: https://cloud.google.com/source-repositories/docs/quickstart-adding-pubsub-notifications
You can get the information like the updated branch name, author, etc, in the notification payload. https://cloud.google.com/source-repositories/docs/pubsub-notifications#notification_example
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