gpt4 book ai didi

git - 使用独立的 git 服务器设置 webhooks?

转载 作者:太空狗 更新时间:2023-10-29 13:40:43 24 4
gpt4 key购买 nike

我正在使用 Jenkins 进行自动化集成和部署。我希望在每次提交到 master 分支后进行构建。

所以我后提交 webhook,或后接收触发器突出显示 hereherehere

所以:

curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>

我正在使用一个独立的 git 服务器(所以不是 github 或 bitbucket),我想创建这个 webhook/触发器。

关于如何做到这一点有什么想法吗?

最佳答案

webhook 意味着您正在推送到 Git 存储库托管服务器,这会触发任何服务器(如您的 Jenkins 服务器)接收到的 JSON 负载,该服务器应对新推送使用react。

但是,如果使用“polling must die”中突出显示的 curl Jenkins API 命令,那正是所需要的

你可以放一个post-receive hook在您要推送到的裸仓库中(在服务器端),它将调用 curl 命令。

并且 Jenkins Jobs 需要配置轮询:

This will scan all the jobs that’s configured to check out the specified URL, and if they are also configured with polling, it’ll immediately trigger the polling (and if that finds a change worth a build, a build will be triggered in turn.)

你可以在我之前的回答“How to configure Git post commit hook”中看到更多。

关于git - 使用独立的 git 服务器设置 webhooks?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27340749/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com