更新 持续集成-交付-发布.md

This commit is contained in:
wxin 2024-08-18 20:47:31 +08:00
parent 62f408213e
commit 4de049052d
1 changed files with 450 additions and 463 deletions

View File

@ -16,7 +16,7 @@
持续部署(Continuous Delivery, CD): 将最终产品发布到生成环境、给用户使用
![img](C:\Users\A\Pictures\jenkins\1.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/1.png)
#### 2.理解持续集成、持续交付、持续部署
@ -26,7 +26,7 @@
持续集成主要是强调开发人员提交了新代码之后,立刻进行构建、(单元)测试。根据测试结果,我们可以确定新代码和原有代码能否正确地集成在一起。简单来讲就是:频繁地(一天多次)将代码集成到主干
![img](C:\Users\A\Pictures\jenkins\2.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/2.png)
持续集成目的在产生以下效益:
@ -48,7 +48,7 @@
持续交付在持续集成的基础上将集成后的代码部署到更贴近真实运行环境的「类生产环境」production-like environments中。比如我们完成单元测试后可以把代码部署到连接数据库的Staging 环境中更多的测试。如果代码没有问题,可以继续手动部署到生产环境中
![img](C:\Users\A\Pictures\jenkins\3.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/3.png)
###### 持续部署:
@ -58,13 +58,13 @@
持续部署即在持续交付的基础上,把部署到生产环境的过程自动化
<img src="C:\Users\A\Pictures\jenkins\4.png" alt="img" style="zoom: 80%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/4.png" alt="img" style="zoom: 80%;" />
## 二Jenkins CI/CD
#### 1.Jenkins CI/CD 流程图
![img](C:\Users\A\Pictures\jenkins\5.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/5.png)
注意:
@ -78,7 +78,7 @@
#### 2.Jenkins 介绍
![img](C:\Users\A\Pictures\jenkins\6.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/6.png)
Jenkins 是一个用Java编写的开源的持续集成工具。在与Oracle发生争执后项目从Hudson项目独立
@ -232,7 +232,7 @@ Tomcat started.
5d3f57bea6e546139fc48ea28f9d5ae5
```
![img](C:\Users\A\Pictures\jenkins\7.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/7.png)
以下是可选操作:
@ -258,13 +258,13 @@ https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
http://mirror.esuni.jp/jenkins/updates/update-center.json
```
![img](C:\Users\A\Pictures\jenkins\8.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/8.png)
![img](C:\Users\A\Pictures\jenkins\9.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/9.png)
![img](C:\Users\A\Pictures\jenkins\10.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/10.png)
![img](C:\Users\A\Pictures\jenkins\11.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/11.png)
## 三Jenkins使用
@ -284,17 +284,17 @@ http://mirror.esuni.jp/jenkins/updates/update-center.json
系统管理->管理插件-可选插件->搜索该插件选中直接安装即可
<img src="C:\Users\A\Pictures\jenkins\12.png" alt="image-20220625122837436" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/12.png" alt="image-20220625122837436" style="zoom:50%;" />
<img src="C:\Users\A\Pictures\jenkins\13.png" alt="image-20220625122922074" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/13.png" alt="image-20220625122922074" style="zoom:50%;" />
#### 3.开启该插件功能
系统管理->全局安全设置-授权策略->选中该插件功能即可->保存
<img src="C:\Users\A\Pictures\jenkins\14.png" alt="image-20220625123057912" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/14.png" alt="image-20220625123057912" style="zoom:50%;" />
<img src="C:\Users\A\Pictures\jenkins\15.png" alt="image-20220625123142667" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/15.png" alt="image-20220625123142667" style="zoom:50%;" />
#### 4. 验证用户管理
@ -302,13 +302,13 @@ http://mirror.esuni.jp/jenkins/updates/update-center.json
注册一个新用户:
<img src="C:\Users\A\Pictures\jenkins\16.png" alt="image-20220625123633639" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/16.png" alt="image-20220625123633639" style="zoom:50%;" />
<img src="C:\Users\A\Pictures\jenkins\17.png" alt="image-20220625123719754" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/17.png" alt="image-20220625123719754" style="zoom:50%;" />
新用户登录验证:
<img src="C:\Users\A\Pictures\jenkins\18.png" alt="image-20220625123832362" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/18.png" alt="image-20220625123832362" style="zoom:50%;" />
注意:
@ -320,9 +320,9 @@ http://mirror.esuni.jp/jenkins/updates/update-center.json
安装 Role-Based Strategy 插件后,系统管理 中多了如图下所示的一个功能,用户权限的划分就是靠他来做的
<img src="C:\Users\A\Pictures\jenkins\19.png" alt="image-20220625124115019" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/19.png" alt="image-20220625124115019" style="zoom:50%;" />
<img src="C:\Users\A\Pictures\jenkins\20.png" alt="image-20220625124135649" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/20.png" alt="image-20220625124135649" style="zoom:50%;" />
Manage Roles管理角色
@ -366,15 +366,15 @@ node roles
Pattern是用来做正则匹配的匹配的内容是节点(slave节点比如说根据正则匹配到的项目项目角色就都有权限
<img src="C:\Users\A\Pictures\jenkins\21.png" alt="image-20220626141733141" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/21.png" alt="image-20220626141733141" style="zoom:50%;" />
将diandian用户绑定全局和项目权限
<img src="C:\Users\A\Pictures\jenkins\22.png" alt="image-20220626142022912" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/22.png" alt="image-20220626142022912" style="zoom:50%;" />
diandian用户查看
<img src="C:\Users\A\Pictures\jenkins\23.png" alt="image-20220626141942574" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/23.png" alt="image-20220626141942574" style="zoom:50%;" />
#### 6.Jenkins 参数化构建
@ -394,39 +394,39 @@ node roles
Git Paramete
![image-20220626142500087](C:\Users\A\Pictures\jenkins\24.png)
![image-20220626142500087](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/24.png)
<img src="C:\Users\A\Pictures\jenkins\25.png" alt="image-20220626142616802" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/25.png" alt="image-20220626142616802" style="zoom:50%;" />
项目配置:
<img src="C:\Users\A\Pictures\jenkins\26.png" alt="image-20220626142826896" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/26.png" alt="image-20220626142826896" style="zoom:50%;" />
<img src="C:\Users\A\Pictures\jenkins\27.png" alt="image-20220626142926277" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/27.png" alt="image-20220626142926277" style="zoom:50%;" />
参数配置:
<img src="C:\Users\A\Pictures\jenkins\28.png" alt="image-20220626143141874" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/28.png" alt="image-20220626143141874" style="zoom:50%;" />
这里这个branch 就相当于给其当做一个变量,然后来为其进行传参:
![](C:\Users\A\Pictures\jenkins\29.png)
![](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/29.png)
构建选择执行shell进行测试
<img src="C:\Users\A\Pictures\jenkins\30.png" alt="image-20220626143702106" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/30.png" alt="image-20220626143702106" style="zoom:50%;" />
<img src="C:\Users\A\Pictures\jenkins\31.png" alt="image-20220626143848722" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/31.png" alt="image-20220626143848722" style="zoom:50%;" />
参数化配置已经生效:
<img src="C:\Users\A\Pictures\jenkins\32.png" alt="image-20220626144303324" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/32.png" alt="image-20220626144303324" style="zoom:50%;" />
构建 test2
可以发现控制台的输出也是成功了的
<img src="C:\Users\A\Pictures\jenkins\33.png" alt="image-20220626144556341" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/33.png" alt="image-20220626144556341" style="zoom:50%;" />
#### 7.数据来源选择文件
@ -439,25 +439,12 @@ abc=t1,t2,t3,t4
web 端配置:
![img](C:\Users\A\Pictures\jenkins\34.png)
![img](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/34.png)
进行测试:
<img src="C:\Users\A\Pictures\jenkins\35.png" alt="image-20220626145317041" style="zoom:50%;" />
<img src="https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/35.png" alt="image-20220626145317041" style="zoom:50%;" />
构建后查看结果:(也是成功的)
![image-20220626145443936](C:\Users\A\Pictures\jenkins\36.png)
![image-20220626145443936](https://oss-wxin-picture.oss-cn-beijing.aliyuncs.com/CI-CD/Jenkins/36.png)