From 0d9d7d8e7a769995efe40c5710b3357506695b5f Mon Sep 17 00:00:00 2001 From: diandian Date: Sun, 15 Oct 2023 22:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- md/持续集成-交付-发布-项目.md | 48 ++++++++-------- md/持续集成-交付-发布.md | 74 ++++++++++++------------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/md/持续集成-交付-发布-项目.md b/md/持续集成-交付-发布-项目.md index 16dd736..212967a 100644 --- a/md/持续集成-交付-发布-项目.md +++ b/md/持续集成-交付-发布-项目.md @@ -22,71 +22,71 @@ Publish Over SSH :通过ssh连接 系统管理--->插件管理---->可选插件--->过滤Deploy to container---->勾选--->直接安装 -image-20220627235514357 +image-20220627235514357 -image-20220627235607259 +image-20220627235607259 #### 3.配置SSH -image-20220627235758575 +image-20220627235758575 -![image-20220627235903284](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/image-20220627235903284.png) +![image-20220627235903284](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/image-20220627235903284.png) -image-20220628000008461 +image-20220628000008461 注意: ​ key:指的是jenkins服务器用哪个用户去远程连接程序服务器就是那个用户的私钥。(记得做免密 jenkins---> web-server) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/K2KQE6euhjvTIomINthtvg.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/K2KQE6euhjvTIomINthtvg.png) #### 4.配置jdk,maven,git -image-20220628000213404 +image-20220628000213404 -image-20220628000256756 +image-20220628000256756 -image-20220628000323472 +image-20220628000323472 -image-20220628000358938 +image-20220628000358938 ## 二:构建发布任务 #### 1.创建maven项目 -image-20220628000510980 +image-20220628000510980 -image-20220628000547600 +image-20220628000547600 #### 2.配置项目 -image-20220628000721842 +image-20220628000721842 -image-20220628000814797 +image-20220628000814797 https://github.com/bingyue/easy-springmvc-maven -​ ![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/vxtF-uRF9X71FkT1Ac_JIA.png) +​ ![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/vxtF-uRF9X71FkT1Ac_JIA.png) 注意: ​ 新版本需要将默认分支改为main -image-20220628003247070 +image-20220628003247070 -image-20220628003459003 +image-20220628003459003 -image-20220628003538519 +image-20220628003538519 调用mave命令 (clean package -Dmaven.test.skip = true) -image-20220628003556160 +image-20220628003556160 保存: -image-20220628003642699 +image-20220628003642699 #### 3.发布服务器部署 @@ -195,13 +195,13 @@ fi #### 4.开始构建任务 -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/3CiCTOTQ2tZ0n6pHy_9N8Q.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/3CiCTOTQ2tZ0n6pHy_9N8Q.png) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/8Zvu0JAjLexNZw4McJs9mw.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/8Zvu0JAjLexNZw4McJs9mw.png) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/xCOkP5CTpof6CmgXsPzrDQ.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/xCOkP5CTpof6CmgXsPzrDQ.png) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83-%E9%A1%B9%E7%9B%AE.assets/vGcPCV6C-Ro_9NcJONgW7g.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/vGcPCV6C-Ro_9NcJONgW7g.png) diff --git a/md/持续集成-交付-发布.md b/md/持续集成-交付-发布.md index 4ccb1ca..639e672 100644 --- a/md/持续集成-交付-发布.md +++ b/md/持续集成-交付-发布.md @@ -16,7 +16,7 @@ ​ 持续部署(Continuous Delivery, CD): 将最终产品发布到生成环境、给用户使用 -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/0WaK2RCAIQn6ytKwCxHoeQ.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/0WaK2RCAIQn6ytKwCxHoeQ.png) #### 2.理解持续集成、持续交付、持续部署 @@ -26,7 +26,7 @@ ​ 持续集成主要是强调开发人员提交了新代码之后,立刻进行构建、(单元)测试。根据测试结果,我们可以确定新代码和原有代码能否正确地集成在一起。简单来讲就是:频繁地(一天多次)将代码集成到主干 -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/YBxLswP38Pz6opB-CfVT-A.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/YBxLswP38Pz6opB-CfVT-A.png) 持续集成目的在产生以下效益: @@ -48,7 +48,7 @@ ​ 持续交付在持续集成的基础上,将集成后的代码部署到更贴近真实运行环境的「类生产环境」(production-like environments)中。比如,我们完成单元测试后,可以把代码部署到连接数据库的Staging 环境中更多的测试。如果代码没有问题,可以继续手动部署到生产环境中 -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/llhsWI4PyQP79NHPB6qpgA.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/llhsWI4PyQP79NHPB6qpgA.png) ###### 持续部署: @@ -58,13 +58,13 @@ ​ 持续部署即在持续交付的基础上,把部署到生产环境的过程自动化 -img +img ## 二:Jenkins CI/CD #### 1.Jenkins CI/CD 流程图 -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/eBMhIj4AgzudBm3Fs4383Q.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/eBMhIj4AgzudBm3Fs4383Q.png) 注意: @@ -80,7 +80,7 @@ #### 2.Jenkins 介绍 -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/7qiG4RjufBF6q708fXRwWg.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/7qiG4RjufBF6q708fXRwWg.png) ​ Jenkins 是一个用Java编写的开源的持续集成工具。在与Oracle发生争执后,项目从Hudson项目独立 @@ -234,7 +234,7 @@ Tomcat started. 5d3f57bea6e546139fc48ea28f9d5ae5 ``` -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/LqMyfFJ8yikl8MXGGT34GA.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/LqMyfFJ8yikl8MXGGT34GA.png) 以下是可选操作: @@ -260,13 +260,13 @@ https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json http://mirror.esuni.jp/jenkins/updates/update-center.json ``` -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/VJnJuX0UtAAq4MI5ErJxVA.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/VJnJuX0UtAAq4MI5ErJxVA.png) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/UE7pdxoWLdHQT7kSZVJnrg.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/UE7pdxoWLdHQT7kSZVJnrg.png) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/T5oHqFkQJyXk1uCy4Wqlsg.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/T5oHqFkQJyXk1uCy4Wqlsg.png) -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/ExigZjVs8eZyJhPLjrNAWw.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/ExigZjVs8eZyJhPLjrNAWw.png) ## 三:Jenkins使用 @@ -286,31 +286,31 @@ http://mirror.esuni.jp/jenkins/updates/update-center.json ​ 系统管理->管理插件-可选插件->搜索该插件选中直接安装即可 -image-20220625122837436 +image-20220625122837436 -image-20220625122922074 +image-20220625122922074 #### 3.开启该插件功能 ​ 系统管理->全局安全设置-授权策略->选中该插件功能即可->保存 -image-20220625123057912 +image-20220625123057912 -image-20220625123142667 +image-20220625123142667 #### 4. 验证用户管理 -image-20220625123328336 +image-20220625123328336 注册一个新用户: -image-20220625123633639 +image-20220625123633639 -image-20220625123719754 +image-20220625123719754 新用户登录验证: -image-20220625123832362 +image-20220625123832362 注意: @@ -322,9 +322,9 @@ http://mirror.esuni.jp/jenkins/updates/update-center.json ​ 安装 Role-Based Strategy 插件后,系统管理 中多了如图下所示的一个功能,用户权限的划分就是靠他来做的 -image-20220625124115019 +image-20220625124115019 -image-20220625124135649 +image-20220625124135649 Manage Roles(管理角色): @@ -368,15 +368,15 @@ node roles: ​ Pattern:是用来做正则匹配的(匹配的内容是节点(slave节点)),比如说根据正则匹配到的项目项目角色就都有权限 -image-20220626141733141 +image-20220626141733141 ​ 将diandian用户绑定全局和项目权限: -image-20220626142022912 +image-20220626142022912 ​ diandian用户查看: -image-20220626141942574 +image-20220626141942574 #### 6.Jenkins 参数化构建 @@ -396,39 +396,39 @@ node roles: ​ Git Paramete -![image-20220626142500087](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/image-20220626142500087.png) +![image-20220626142500087](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/image-20220626142500087.png) -image-20220626142616802 +image-20220626142616802 ​ 项目配置: -image-20220626142826896 +image-20220626142826896 -image-20220626142926277 +image-20220626142926277 ​ 参数配置: -image-20220626143141874 +image-20220626143141874 ​ 这里这个branch 就相当于给其当做一个变量,然后来为其进行传参: -![](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/image-20220626144229208.png) +![](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/image-20220626144229208.png) ​ 构建选择执行shell进行测试: -image-20220626143702106 +image-20220626143702106 -image-20220626143848722 +image-20220626143848722 ​ 参数化配置已经生效: -image-20220626144303324 +image-20220626144303324 ​ 构建 test2: ​ 可以发现控制台的输出也是成功了的 -image-20220626144556341 +image-20220626144556341 #### 7.数据来源选择文件 @@ -441,15 +441,15 @@ abc=t1,t2,t3,t4 ​ web 端配置: -![img](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/0USIqGXVd0iujSq_YmjGHg.png) +![img](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/0USIqGXVd0iujSq_YmjGHg.png) ​ 进行测试: -image-20220626145317041 +image-20220626145317041 ​ 构建后查看结果:(也是成功的) -![image-20220626145443936](%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-%E4%BA%A4%E4%BB%98-%E5%8F%91%E5%B8%83.assets/image-20220626145443936.png) +![image-20220626145443936](https://xingdian-image.oss-cn-beijing.aliyuncs.com/xingdian-image/image-20220626145443936.png)