Is there an alternative to a “push” hook?

前端 未结 2 1361
深忆病人
深忆病人 2021-01-16 09:28

Bitbucket, Github and other services tend to have a \"push\" hook, so that when you push code to the repository, the service can hit a url (possible on a production server),

2条回答
  •  生来不讨喜
    2021-01-16 10:00

    The push event of a GitHub webhook allows for the repository server (GitHub) to contact repository clients (your servers in the cloud)

    But if that doesn't work, you would have two approaches:

    • have one dedicated repo client (one dedicated server of yours) which would be contacted by this GitHub webhook, and would know which servers on the cloud are available and need to be contacted.
    • or switch to a pull approach where a server on the cloud periodically does a git pull, followed by a git push to a bare repo (still on the same cloud server): a post-receive hook on that bare repo can be triggered if the git push pushed anything at all (As I mentioned in the comments of "How to execute a command right after a fetch or pull command in git?").

提交回复
热议问题