# testhook **Repository Path**: douboer/testhook ## Basic Information - **Project Name**: testhook - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-26 - **Last Updated**: 2024-02-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 用gitee webhook自动部署 逻辑: ``` gitee webhook触发 ⬆︎ ⬇︎ 客户端访问http://www.biboer.cn:8080/hook 或git push到gitee | 服务器侧监听,并调用执行shell脚本,从gitee pull,记录日志 ``` ## 建项目,配置webhook 建项目,配置webhook,gitee/github/gitlab配置方法基本一 ![img](imgs/hook1.png) ![img](imgs/hook2.png)  ## 写服务器侧shell 要做的事情,这里是从gitee pull内容。pullgit.sh,就两句 ``` #!/bin/sh git pull origin main 写完之后: chmod +x pulpit.sh ``` 写一段python代码,在服务器侧监听80端口,当用户访问http://www.biboer.cn/hook/地址时,触发调用/Users/gavin/testhook下的"pullgit.sh"shell脚本,并记录log,写到log文件test.log中 ## 服务器侧监听 写一段服务器侧的监听代码,80端口在webservice中被占用了,所以用8080或其他可用端口。 这里节省时间,让AI写这段代码。测试,无需任何修改,完美可运行。 > 服务器测代码让copilot写。提示语: 写一段python代码,在服务器侧监听80端口,当用户访问http://www.biboer.cn/hook/地址时,触发调用/Users/gavin/testhook下的"pullgit.sh"shell脚本,并记录log,写到log文件test.log中 ![img](imgs/hook3.png)  注:为了不改变服务端侧的内容,log改为输出到:/home/gavin/test.log ## 验证 ![img](imgs/hook4.png)