下载安装
注意:推荐的LTS版本对部分插件不适配,直接用最新的版本,jenkins还需要用到git和maven,服务器上已经安装,可查看参考文档[1]、[2],本次不再演示
下载jenkins

上传至服务器后执行以下命令启动jenkins
nohup java -jar jenkins.war --httpPort=18888 &
查看日志
tail -fn 200 nohup.out

复制框中内容
访问jenkins

进入以下页面后输入复制的内容,点击继续

安装推荐的插件

设置用户名密码


安装maven插件

配置Gitee项目
安装gitee插件

添加gitee连接

完成后测试连接,成功后保存应用

新建任务

- 配置General

- 源码管理配置

- 构建触发器
注意webhookurl,需要在git中配置

生成webhook密码

- Build Steps
只是比较简单的测试,服务器上已经git clone了测试项目,正式的是要经过拉取代码、重新打包、项目启动等步骤的

gitee配置
进入git项目,点击管理,配置WebHooks,填充URL和密码

测试
注意:虽然gitee有测试功能,但是有bug,直接测试会报404,如果想测试需要将push_hooks改为Push Hook
- 简单测试

直接使用postman进行测试

查看jenkins,发现推送成功

- 推送代码测试
本地提交代码

jenkins执行成功

查看服务器上HelloController的代码,代码变为hello world

参考文档
[1].Centos安装配置Git
[3].Jenkins文档