Jenkins

1 篇文章 0 订阅
1 篇文章 0 订阅

Jenkins

一、jenkins是什么?

Jenkins是一个开源的、提供友好操作界面的持续集成(CI)工具,起源于Hudson(Hudson是商用的),主要用于持续、自动的构建/测试软件项目、监控外部任务的运行。Jenkins用Java语言编写,可在Tomcat等流行的servlet容器中运行,也可独立运行。通常与版本管理工具(SCM)、构建工具结合使用。常用的版本控制工具有SVN、GIT,构建工具有Maven、Ant、Gradle。

二、CI/CD是什么?

CI(Continuous integration,中文意思是持续集成)是一种软件开发时间。持续集成强调开发人员提交了新代码之后,立刻进行构建、(单元)测试。根据测试结果,我们可以确定新代码和原有代码能否正确地集成在一起。借用网络图片对CI加以理解。
在这里插入图片描述
CD(Continuous Delivery, 中文意思持续交付)是在持续集成的基础上,将集成后的代码部署到更贴近真实运行环境(类生产环境)中。比如,我们完成单元测试后,可以把代码部署到连接数据库的Staging环境中更多的测试。如果代码没有问题,可以继续手动部署到生产环境。下图反应的是CI/CD 的大概工作模式。
在这里插入图片描述

过程

CI
1.首先是开发人员写相应的代码(写好之后就把代码提交到gitlub上面去)
2.写完代码之后然后再打包
3.打包完成之后,然后再部署。
4.发布完成之后然后就是测试人员测试
(开发、和测试用的,就算用奔溃了可以重新再部署一个)
(它不适用生产环境,因为有客户在使用)

CD
持续交互
5.测试人员测试没有任何问题之后,然后就把他放到代码仓库里面去(把它放到docker里面去,把它打包成一个docker镜像)
持续部署
从刚刚放到docker里面的一个镜像把它拉到生产环境里面去部署
6.持续部署我们应该人为发布,不能CICD自动化发布,因为我们不知道什么时候要发布,我们必须得到一个精确的发布时间,然后要走流程,流程通过之后我们再手动发布,所有我们的持续部署要用手动发布。

安装jenkins

[root@RS1 ~]# wget -O /etc/yum.repos.d/jenkin
s.repo https://pkg.jenkins.io/redhat-stable/j
enkins.repo
--2021-10-17 22:22:13--  https://pkg.jenkins.
io/redhat-stable/jenkins.repo
正在解析主机 pkg.jenkins.io (pkg.jenkins.io).
.. 151.101.78.133, 2a04:4e42:12::645
正在连接 pkg.jenkins.io (pkg.jenkins.io)|151.
101.78.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:85
正在保存至: “/etc/yum.repos.d/jenkins.repo”

      /etc/   0%       0  --.-KB/s           
/etc/yum.re 100%      85  --.-KB/s  用时 0s  
    

2021-10-17 22:22:14 (9.63 MB/s) - 已保存 “/et
c/yum.repos.d/jenkins.repo” [85/85])

[root@RS1 ~]# ls /etc/yum.repos.d/
Centos-8.repo
CentOS-Base.repo
epel-modular.repo
epel-playground.repo
epel.repo
epel-testing-modular.repo
epel-testing.repo
jenkins.repo
redhat.repo
[root@RS1 ~]# rpm --import https://pkg.jenkin
s.io/redhat-stable/jenkins.io.key
[root@RS1 ~]# yum install epel-release # repo
sitory that provides 'daemonize'
Updating Subscription Management repositories
.
Unable to read consumer identity
This system is not registered to Red Hat Subs
cription Management. You can use subscription
-manager to register.
警告:加载 '/etc/yum.repos.d/CentOS-Base.repo
' 失败,跳过。
Jenkins-stable                                                           1.3 kB/s |  21 kB     00:16    
软件包 epel-release-8-11.el8.noarch 已安装。
依赖关系解决。
=========================================================================================================
 软件包                       架构                   版本                     仓库                  大小
=========================================================================================================
升级:
 epel-release                 noarch                 8-13.el8                 epel                  23 k

事务概要
=========================================================================================================
升级  1 软件包

总下载:23 k
确定吗?[y/N]: y
下载软件包:
epel-release-8-13.el8.noarch.rpm                                          61 kB/s |  23 kB     00:00    
---------------------------------------------------------------------------------------------------------
总计                                                                     3.8 kB/s |  23 kB     00:06     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                          1/1 
  运行脚本: epel-release-8-13.el8.noarch                                                             1/1 
  升级    : epel-release-8-13.el8.noarch                                                             1/2 
  清理    : epel-release-8-11.el8.noarch                                                             2/2 
  运行脚本: epel-release-8-11.el8.noarch                                                             2/2 
  验证    : epel-release-8-13.el8.noarch                                                             1/2 
  验证    : epel-release-8-11.el8.noarch                                                             2/2 
Installed products updated.

已升级:
  epel-release-8-13.el8.noarch                                                                           

完毕!
[root@RS1 ~]# yum install java-11-openjdk-devel^C
[root@RS1 ~]# yum install jenkins
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
警告:加载 '/etc/yum.repos.d/CentOS-Base.repo' 失败,跳过。
上次元数据过期检查:0:00:49 前,执行于 2021年10月17日 星期日 22时24分02秒。
依赖关系解决。
=========================================================================================================
 软件包                   架构                  版本                        仓库                    大小
=========================================================================================================
安装:
 jenkins                  noarch                2.303.2-1.1                 jenkins                 69 M
安装依赖关系:
 daemonize                x86_64                1.7.8-1.el8                 epel                    27 k

事务概要
=========================================================================================================
安装  2 软件包

总下载:69 M
安装大小:69 M
确定吗?[y/N]: y
下载软件包:
(1/2): daemonize-1.7.8-1.el8.x86_64.rpm                                   84 kB/s |  27 kB     00:00    
(2/2): jenkins-2.303.2-1.1.noarch.rpm                                    1.6 MB/s |  69 MB     00:44    
---------------------------------------------------------------------------------------------------------
总计                                                                     1.5 MB/s |  69 MB     00:45     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                          1/1 
  安装    : daemonize-1.7.8-1.el8.x86_64                                                             1/2 
  运行脚本: jenkins-2.303.2-1.1.noarch                                                               2/2 
  安装    : jenkins-2.303.2-1.1.noarch                                                               2/2 
  运行脚本: jenkins-2.303.2-1.1.noarch                                                               2/2 
  验证    : daemonize-1.7.8-1.el8.x86_64                                                             1/2 
  验证    : jenkins-2.303.2-1.1.noarch                                                               2/2 
Installed products updated.

已安装:
  daemonize-1.7.8-1.el8.x86_64                         jenkins-2.303.2-1.1.noarch                        

完毕!

[root@RS1 webapps]# ls
jenkins.war
[root@RS1 webapps]# /usr/local/tomcat/bin/catalina.sh restart
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Usage: catalina.sh ( commands ... )
commands:
  debug             Start Catalina in a debugger
  debug -security   Debug Catalina with a security manager
  jpda start        Start Catalina under JPDA debugger
  run               Start Catalina in the current window
  run -security     Start in the current window with security manager
  start             Start Catalina in a separate window
  start -security   Start in a separate window with security manager
  stop              Stop Catalina, waiting up to 5 seconds for the process to end
  stop n            Stop Catalina, waiting up to n seconds for the process to end
  stop -force       Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
  stop n -force     Stop Catalina, wait up to n seconds and then use kill -KILL if still running
  configtest        Run a basic syntax check on server.xml - check exit code for result
  version           What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is defined
[root@RS1 webapps]# ls
jenkins  jenkins.war


在这里插入图片描述
查看密码

[root@RS1 webapps]# cat /root/.jenkins/secrets/initialAdminPassword
4ff8e975e9774d90a9c65824f7c2af5e
[root@RS1 webapps]# 

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值