gitlab+jenkins+hook代码自动构建发布上线

Gitlab+Jenkins+Hook

1、gitlab和jenkins的安装见:

http://www.cnblogs.com/cuishuai/p/7544663.html

http://www.cnblogs.com/cuishuai/p/7544775.html

2、gitlab配置

1)创建一个project,并创建一个monkey的分支。

2)对分支进行设置:

点击project->settings->integrations:

1、

 

2、

 

3

Webhook,点击test,返回如下表示成功:

 

3、配置jenkins

1)构建一个项目:

 

项目名称和gitlab地址,例如:http://gitlab.mytest.com

2)

 

勾选此选项,用于指定运行的服务器。

3)

 

配置项目的url:

例如:git@gitlab.mytest.com:mytest/mytest.git

      http://gitlab.mytest.com/root/mytest

4)

 

这个Service  URL,非常重要,需要copy到gitlab那个配置地方:

构建后的操作:

 

发邮件:

 

服务器端shell的操作:

cd  /data/doge

pm2   deploy  ecosystem.doge.json  doge setup

原文地址:https://www.cnblogs.com/cuishuai/p/7544895.html