Use Jenkins on Linux

What is Continuous Integration

持续集成 Continuous integration ,简称CI 随着软件开发复杂度的不断提高,团队开发成员间如何更好
地协同工作以确保软件 开发的质量已经慢慢成为开发过程中不可回避的问题。尤其是近些年来,敏捷
(Agile) 在软件工程领域越来越红火,如何能再不断变化的需求中快速适应和保证软件的质量也 显得
尤其的重要。 持续集成正是针对这一类问题的一种软件开发实践。它倡导团队开发成员必须经常 集成
他们的工作,甚至每天都可能发生多次集成。而每次的集成都是通过自动化的构建 来验证,包括自动
编译、发布和测试,从而尽快地发现集成错误,让团队能够更快的开 发内聚的软件。 

持续集成具有的特点: 
它是一个自动化的周期性的集成测试过程,从检出代码、编译构建、运行测试、结果 记录、
测试统计等都是自动完成的,无需人工干预; 需要有专门的集成服务器来执行集成构建; 需要有代码
托管工具支持,我们下一小节将介绍Git以及可视化界面Gogs的使用 
持续集成的作用: 
保证团队开发人员提交代码的质量,减轻了软件发布时的压力; 持续集成中的任何一个环节都是自动完成的,无需
太多的人工干预,有利于减少重复 过程以节省时间、费用和工作量;

Jenkins Profile

Jenkins,原名Hudson,2011年改为现在的名字,它是一个开源的实现持续集成的 软件工具。官方
网站:http://jenkins-ci.org/。 Jenkins 能实施监控集成中存在的错误,提供详细的日志文件和提醒
功能,还能用图 表的形式形象地展示项目构建的趋势和稳定性。

特点:
易安装:仅仅一个 java -jar jenkins.war,从官网下载该文件后,直接运行,无需额 外的安装,更无需安装数据库; 
易配置:提供友好的GUI配置界面; 
变更支持:Jenkins能从代码仓库(Subversion/CVS)中获取并产生代码更新列表并 输出到编译输出信息中; 
支持永久链接:用户是通过web来访问Jenkins的,而这些web页面的链接地址都是 永久链接地址,因此,你可以在各种文档中直接使用该链接; 
集成E-Mail/RSS/IM:当完成一次集成时,可通过这些工具实时告诉你集成结果(据 我所知,构建一次集成需要花费一定时间,有了这个功能,你就可以在等待结果过程 中,干别的事情);
JUnit/TestNG测试报告:也就是用以图表等形式提供详细的测试报表功能; 
支持分布式构建:Jenkins可以把集成构建等工作分发到多台计算机中完成; 
文件指纹信息:Jenkins会保存哪次集成构建产生了哪些jars文件,哪一次集成构建使 用了哪个版本的jars文件等构建记录; 
支持第三方插件:使得Jenkins变得越来越强大。

Jenkins installation

jdk Installation
(1) jdk-8u171-linux-x64.rpm uploaded to the server (VM)
(2) run the install command-8u171-RPM -ivh Linux-jdk x64.rpm
the RPM mounted JDK, which is the root directory: /usr/java/jdk1.8.0_171-amd64
Jenkins installation and start-
1, download Jenkins
wget https://pkg.jenkins.io/redhat/jenkins-2.83-1.1.noarch.rpm or jenkins-2.83-1.1.noarch .rpm uploaded to the server
also can download from your computer down and then upload the past
https://pkg.jenkins.io/redhat/
2, installation Jenkins
RPM -ivh Jenkins-2.83-1.1.noarch.rpm
3, configure Jenkins
vi / etc / sysconfig / jenkins
modify users and port
JENKINS_USER = "root"
JENKINS_PORT = "8888"
4, start the service
systemctl start Jenkins
5, http://192.168.184.135:8888 access the link
from / var / lib / jenkins / secrets / initialAdminPassword obtaining initial password string
Here Insert Picture Description
6, the mounting plug
Here turn off the plug-in page, and finally configuration, refer to Jenkins for Windows installation configuration.
7, New User
Here Insert Picture Description

Jenkins plug-in installation

We have to install maven plugin, for example, to install the demo plug-ins
(1) Click on the left side of the "System Management" menu, then click
Here Insert Picture Description
(2) Select "Optional plug-ins" tab, search maven, select Maven Integration in the list, click "direct
contact installation" button
Here Insert Picture Description
when seen in the following figure, showing complete
Here Insert Picture Description

Global Configuration Tool

Installation Maven local repository
(1) the compressed Maven uploaded to the server (VM)
(2) extracting Apache-Maven-zxvf the tar-bin.tar.gz 3.5.4
(. 3) Mobile Directory mv apache-maven-3.5. . 4 / usr / local / Maven
(. 4) edit profile setting.xml vi /usr/local/maven/conf/settings.xml, configure the local warehouse
database directory, reads / usr / local / repository
(. 5) the development environment local warehouse uploaded to the server (virtual machine) and move it to / usr / local / repository.
mv reponsitory_boot / usr / local / repository
to perform this step would not be necessary to re-download the pack when packing shorten the time.
Global Configuration tool
selection system management, global tool to configure
the JDK configuration
Here Insert Picture Description
settings javahome to /usr/java/jdk1.8.0_171-amd64
Git configuration (local Git software already installed)
Here Insert Picture Description
Maven configuration
Here Insert Picture Description

Published 81 original articles · won praise 5 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_36205206/article/details/104589330