1、先在Jenkins安装插件Gitlab Hook Plugin 和Build Authorization Token Root Plugin

wKiom1jmCUXyJIMTAAAVy5LVXlM358.png

wKiom1jmEJyx7L-VAAAbomRPDDs402.jpg

2.插件安装完成后在任务里添加token

wKioL1jmDy-RGILYAAEZdZBcQSw725.jpg-wh_50

3、在gitlab上添加钩子

wKiom1jmEimjXoKHAADfGyFwU9g117.jpg-wh_50

4、点击测试钩子或push代码再看Jenkins已经在构建了就说明成功了(也可以在浏览器直接执行这个URL)

wKioL1jmYbyhCHnuAAAukmRHL3o568.jpg

wKioL1jm9X7APWaAAAB3rEJ43qI296.jpg