CI (Continuous Integration) continuous integration

CI (Continuous Integration) continuous integration, CD (Continuous Delivery) continuous delivery

Why do CI

1, a branch offset from the trunk

2, unknown project progress

3, find a bug later

4, positioning of complex

CI Value

1. binary packages ready to reduce the risk: static code analysis, find a bug as soon as possible

2. Automation: Automated compilation, automated testing, automated deployment, automatic review, automatic feedback

3. publish at any time

Emphasis

In order to improve the quality of the code has been posted to the stability of the beta every environmental services, to improve the automated test coverage (not limited to the interface test automation)

CI System Flow

Flowchart is as follows:

CI detailed flow diagram of the

Code submission process

Self-test environment publishing process

1, when the codes have git lab merge request to initiate dev_test branch, jenkins sonar triggered scan self-test environment;

2, sonar scanning - for dev_test branch;

3, unit testing - for dev_test branch;

4, self-test environment to build and run the self-test environment - for dev_test branch;

5, the implementation of the interface automated testing;

6, after the interface through automated testing, carried out in self-test function test environment, test new interfaces and add new test points to automated test case library.

Beta release process environment (branch: dev)

1, when the upper branch of the code git lab with a request to initiate a merge dev, trigger jenkins sonar scanning;

2, sonar scanning - for the dev branch

3, unit testing - for the dev branch

4, self-test environment to build and run the self-test environment - for the dev branch

5, the implementation of the interface automated testing;

6, after the interface through automated testing, test by the dev branch to the beta release and deployment environment.

Process trigger mechanism

1, gitlab webhooks

2, URL address at the input url construction, an additional token information;

http://jenkins.cn/view/decision/job/decision-sonar/build

3, Secret Token input jenkins in need of gitlab merge request triggers the project configuration identity token

When configuring the merge request trigger trigger mechanism

4, submit merge requests, triggering processes

Instructions

1、新建jenkins项目
新建sonar扫描、单元测试、构建、自动化测试、beta环境构建五个项目。

2、配置meta data

3、新建pipeline视图

4、设置CI初始项目名称

5、CI初始项目设置依赖关系.注意:依赖关系一定要顺序执行,避免形成环形依赖

6、设置预警声音(可自定义声音,音频格式的文件为wav格式,并且将音频文件打包好给叶柄添加到jenkins服务器上即可)

7、Sonar扫描项目配置
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent
mvn sonar:sonar

8、单元测试项目配置
-Dmaven.test.skip=false

9、自动化项目配置
http://jenkins.puhuitech.cn/view/decision/job/puhui-decision-autotest/

10、发送测试报告

1)、安装jenkins插件,Editable Email Notification

2)、选择构建后操作,Editable Email Notification;

3)、Project Recipient List:输入收件人的邮箱地址,收件人之间使用逗号隔开;

4)、Default Subject:邮件主题

5)、Default Content:邮件内容自定义

预热内容--使用Groovy脚本新建pipeline流程

1、新建一个项目类型为Pipeline的jenkins工程

2、配置groovy脚本

3、pipeline 模板脚本生成

4、pipeline进程查看

5、jenkins 2.0建自动化构建之pipeline语法:

Guess you like

Origin www.cnblogs.com/chenxiba/p/11306707.html