文章目录
接上篇:
https://blog.csdn.net/shenyuanhaojie/article/details/122922980?spm=1001.2014.3001.5501
1. 开启 webhook 功能
使用 root
账户登录到后台,点击 Admin Area -> Settings -> Network
勾选 Allow requests to the local network from web hooks and services
2. Jenkins 安装插件与配置
安装 webhook 和 Gitlab 插件
在 web_demo_pipeline 项目配置
- 应用保存。
- 取消上篇的 SCM 选项。
3. 在项目添加 webhook
**钩子服务成功,但是权限不够,不具备 Jenkins 的访问权限。**
4. Jenkins 中设置
Manage Jenkins -> Configure System
应用保存。
5. 回到 gitlab 上再次 test
访问成功。
6. 使用 web hook 完成自动构建
修改 IDEA 代码并提交
7. 查看 Jenkins 是否自动构建
8. 查看 Tomcat 发布结果
9. Webhook 和 SCM 的区别
- webhook:当 Gitlab 项目代码发生变化,Jenkins 会自动触发构建。
- SCM:Jenkins 定时检测 Gitlab 代码是否变化,变化触发构建,无变化不触发构建。