1.安装插件git

jenkins+gitlab自动化构建_触发器

 

2.安装插件github

jenkins+gitlab自动化构建_触发器_02

 

3.进入任务-->配置-->构建触发器

jenkins+gitlab自动化构建_github_03

 

 

4.选择Build when a change is pushed to GitLab. GitLab webhook URL: http://127.0.0.1:8081/jenkins/project/xxx 再点击高级

Generate 出Secret token,复制 Secret token(gitlab需要)

jenkins+gitlab自动化构建_git_04

 

 

5.应用-->保存

6.进入gitlab项目setting-->webhooks,填入jenkins的URL跟Secret token

jenkins+gitlab自动化构建_github_05

 

7.根据需要选择trigger类型

jenkins+gitlab自动化构建_git_06