1. jenkins安装插件
    • Gitlab Hook Plugin
    • GitLab Plugin
  2. jenkins系统设置
    • Enable authentication for ‘/project’ end-point 去掉勾子,否则gitlab触发webhook自动构建,会出现调用jenkins没有权限的问题
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>Error 403 anonymous is missing the Job/Build permission</title>
    <body><h2>HTTP ERROR 403</h2>
    <p>Problem accessing /project/robot_test. Reason:
    <pre>    anonymous is missing the Job/Build permission</pre></p><hr><a href="">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
  3. jenkins设置项目push自动编译
    • Build Triggers > Build when a change is pushed to GitLab
  4. Gitlab设置webhook
    • settings > Integrations,URL填jenkins项目里GitLab webhook URL后面的地址