Webhooks on file-level, so they only execute when particular files changed, possible?

Hello! I am running a self-hosted GitLab instance on a Docker daemon on my server. It works as expected. I am also using Portainer and in one of my git-repositories I host all the docker-compose.yml and further configuration files for multiple stacks.

Whenever I update a docker-compose.yml, I’d need to call Portainer using a webhook to notify it to auto-update itself. It currently works, but the webhook is currently set up “on push”.

What I would like, is, to only call that webhook when a particular docker-compose.yml file is altered (say that of my Nexus or that of Watchtower etc.). As matters are now, all of them will be notified. It probably is not a problem as those stacks, whose services did not change, will not update anything, but it feels redundant and unnecessary to call the webhooks at all.

I probably could make a .gitlab-ci.yml, which checks the files that were changed and makes the corresponding webhook-calls, but that feels a bit like overkill.

Does anyone have a better suggestion? Did I perhaps miss a feature? I’ve read there are filehooks in GitLab, too, but from what I read I do not think they’ll help me in my case.

I also apologize if I have created this topic in the wrong sub-forum, but I thought this one would fit the best.

1 Like