
主要内容(按操作顺序)
- 准备工作,安装Jenkins插件
- 配置Jenkins任务
- 配置Gitlab触发机制
准备工作
- Jenkins
- 安装插件(Gitlab和Gitlab Hook,以及FTP发布插件)
- Gitlab
- 无



配置Jenkins
配置项:General
默认
配置项:源码管理
选择GIT,配置Repository URL和Credentials

配置项:构建触发器
选择“Build when a change is pushed to GitLab”
红框里面的URL很重要,叫它“webhook URL”

展开高级选项,点击Generate,生成另外一个很重要的webhook secret key

配置项:构建环境
默认
配置项: 构建
“增加构建步骤”,选择“Invoke Gradle script”
注意
- Make gradlew executable选中
- 如果环境可以联网,则通过项目的配置自动下载。wrapper location不需要指定

配置项: 构建后操作
“增加构建后操作步骤”,选择“Send build artifacts over FTP”并配置相关信息

配置Gitlab
在Gitlab中的Repository Setting中 Integrations中
添加Webhook,配置Jenkins时,有两个很重要的概念(webhook URL和webhook secret key)

网友评论