Hmmm, I’m a bit confused about a few things you mentioned:
Whew, that makes much sense! Both that there would be two (causing two builds) and that the reason for the two would be “configured two netlify sites to use this repo”
One hook on a repo will notify ALL netlify sites connected to that repo, regardless of who configured either side.
While this is true, you can still do some filtering. For instance, when creating a webhook in Gitlab you have the opportunity to provide a secret token. You can provide a unique token and associate that with the site for which the webhook was created. Whenever a webhook makes a call it provides that token in the
x-gitlab-token header, which you can use to see if they match and if they don’t just disregard the call.
A cleaner but more expensive solution would be to create a unique “internal” URL for each site, and associate that to its corresponding webhook.
This would avoid multiple builds for a single commit. Each commit will rebuild every associated site just once, which is the expected behavior. Otherwise, if you have let’s say 10 sites associated to a single repository, for each commit in that repository you could potentially end up building each site 10 times!
When you or we remove a netlify site or its repo association, we do NOT (cannot, if we do it, since we have no permissions to your git login; only your browser has them!) remove any webhooks that were configured prior
This is something that doesn’t quite add up from my point of view. When connecting my Gitlab account to my Netlify account, the OAuth process kicks in and I grant Gitlab permissions to Netlify. You actually use those permissions to create these webhooks in Gitlab in the first place whenever I create/link my Netlify site to my Gitlab repo. Why not delete them when the site gets deleted?
Thanks again for all the help!