🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
目的为在公司的测试环境当中一旦开发向gitlab仓库提交成功代码,gitlab通知jenkins进行构建项目 一)jenkins相关配置 1.1、安装插件 系统管理-管理插件-可选插件 Gitlab Hook Plugin和Build Authorization Token Root Plugin ![](https://box.kancloud.cn/9db73a51f29414732447ef6e24577d94_1059x344.png) 1.2 生成随机token [www@jenkins .ssh]$ sudo openssl rand -hex 16 sudo: timestamp too far in the future: Jan 2 19:32:54 2018 We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for www: 3148b091f116d1a14e15aa2d0cf2f156 1.3、配置jenkins 创建项目触发器 ![](https://box.kancloud.cn/fcc6bccaa2934ecc3d85852cbb1d4180_1035x522.png) 二)gitlab配置 2.1:在git项目配置界面设置链接和token ![](https://box.kancloud.cn/9a844cd5e2ed8a4fbbe520e8563ecb84_1366x624.png) 2.2)测试 [root@static yyg]# echo "this is b.html" > b.html [root@static yyg]# git add . [root@static yyg]# git commit -m "add b.html" [master 66f0c74] add b.html 1 file changed, 1 insertion(+) create mode 100644 b.html [root@static yyg]# git push origin master 然后查看jenkins ![](https://box.kancloud.cn/a17e773459c4c82be2d68f0d75c96c3b_889x501.png)