Windows 下部署Jenkins相关插件总结
2017-08-04 16:46
555 查看
Jenkins部署文档
安装步骤:
解压后双击安装包jenkins.msi,按照提示点击[下一步]。。。[下一步]即可
安装后查看服务管理器,新出现一个名为[Jenkins]的服务
启动服务时,可能出现端口(默认8080端口)被占用的问题,我们可通过修改配置文件的方式来修改Jenkins的端口号,配置文件路径:%jenkins_home%\jenkins.xml
<arguments>-Xrs-Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar"%BASE%\jenkins.war" --httpPort=8080</arguments>
修改后,需要重启Jenkins服务
每个机器是一个节点(slave),可以和Jenkins的构建机器发生通讯
我们需要在多少个机器上测试,就需要创建多少个节点。
其他相关使用操作,详见$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/Jenkins使用文档.docx
这个链接下不仅有Sonar服务器的安装包还有相关插件的下载
已下载的sonar 相关产品的TFS路径:
$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/sonarqube-5.2.zip
安装前提:
1、 存在一个Sonar的数据库
2、 系统安装有JDK
安装步骤:
1、 解压
2、 设置配置文件%Sonarqube_home%\conf\sonar.properties
2.1、设置数据库连接账号和密码
#--------------------------------------------------------------------------------------------------
# DATABASE
#
# IMPORTANT: the embedded H2database is used by default. It is recommended for tests but not for
# production use. Supporteddatabases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.
# User credentials.
# Permissions to createtables, indices and triggers must be granted to JDBC user.
# The schema must be createdfirst.
sonar.jdbc.username=sa
sonar.jdbc.password=sa
2.2、设置数据库连接字符串
根据自己的数据库类型(MySQL/ Oracle/PostgreSQL/SQLServer/)选择放开哪一部分,以SQLServer为例
#----- Microsoft SQLServer 2008/2012/2014 and SQL Azure
# A database named sonar must exist and its collation must becase-sensitive (CS) and accent-sensitive (AS)
# Use the following connection string if you want to use integratedsecurity with Microsoft Sql Server
# Do not set sonar.jdbc.username or sonar.jdbc.password property if youare using Integrated Security
# For Integrated Security to work, you have to download the MicrosoftSQL JDBC driver package from
#http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
# and copy sqljdbc_auth.dll to your path. You have to copy the 32 bit or64 bit version of the dll
# depending upon the architecture of your server machine.
# This version of SonarQube has been tested with Microsoft SQL JDBCversion 4.1
#sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true
# Use the following connection string if you want to use SQL Auth whileconnecting to MS Sql Server.
# Set the sonar.jdbc.username and sonar.jdbc.password appropriately.
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar
2.3、
根据需求设置Connection pool settings
#----- Connection pool settings
# The maximum number of active connections that can be allocated
# at the same time, or negative for no limit.
# The recommended value is 1.2 * max sizes of HTTP/HTTPS pools. Forexample if both HTTP and
# HTTPS ports are enabled with default sizes (50, see propertiessonar.web.http.maxThreads
# and sonar.web.https.maxThreads) then sonar.jdbc.maxActive should be1.2 * (50 + 50) = 120.
# sonar.jdbc.maxActive=60
# The maximum number of connections that can remain idle in the
# pool, without extra ones being released, or negative for no limit.
# sonar.jdbc.maxIdle=5
# The minimum number of connections that can remain idle in the pool,
# without extra ones being created, or zero to create none.
# sonar.jdbc.minIdle=2
# The maximum number of milliseconds that the pool will wait (when there
# are no available connections) for a connection to be returned before
# throwing an exception, or <= 0 to wait indefinitely.
# sonar.jdbc.maxWait=5000
# sonar.jdbc.minEvictableIdleTimeMillis=600000
# sonar.jdbc.timeBetweenEvictionRunsMillis=30000
2.4、
设置WEB SERVER
# WEB SERVER
# Web server is executed in a dedicated Java process. By default heapsize is 768Mb.
# Use the following property to customize JVM options.
# Recommendations:
#
# The HotSpot Server VM isrecommended. The property -server should be added if server mode
#isnotenabledbydefaultonyourenvironment:http://docs.oracle.com/javase/7/docs/technotes/gui#des/vm/server-class.html
#sonar.web.javaOpts=-Xmx768m-Xms256m-XX:MaxPermSize=160m-XX:+HeapDumpOnOutOfMe#moryError-Djava.net.preferIPv4Stack=true
# Same as previous property, but allows to not repeat all other settingslike -Xmx
#sonar.web.javaAdditionalOpts=
# Binding IP address. For servers with more than one IP address, thisproperty specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with theserver.
sonar.web.host=192.168.1.189
# Web context. When set, it must start with forward slash (for example/sonarqube).
# The default value is root context (empty value).
#sonar.web.context=sonar.web.host/port/context
#sonar.web.context=sonar.web.host/9000/context
# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=9000
3、 启动Sonarqube
执行%Sonarqube_home%目录下的StartSonar.bat
另外,可以安装Sonar相关插件,比如中文插件,C#插件等,具体安装方法是下载插件的jar文件,将其放置在%sonar_home%\extensions\plugins下,重启Sonar即可
目前已下载的相关插件存储路径:$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/sonarqube插件
$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/sonar-runner-dist-2.3.zip
安装前提:已安装Sonarqube
安装步骤:
1、 将文件解压到本地目录
2、 设置环境变量
2.1 新增环境变量[SONAR_RUNNER_HOME]=[安装路径]
2.2 编辑环境变量[path]
追加[;%SONAR_RUNNER_HOME%\bin]
3、 编辑sonar-runner.properties,根据实际情况选择放开注释
#Configurehere general information about the environment, such as SonarQube DB detailsfor example
#Noinformation about specific project should appear here
#-----Default SonarQube server
sonar.host.url=http://192.168.1.189:9000
#-----PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#-----MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
#-----Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
#-----Microsoft SQLServer
sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#-----Global database settings
sonar.jdbc.username=sa
sonar.jdbc.password=sa
#-----Default source code encoding
sonar.sourceEncoding=UTF-8
#-----Security (when 'sonar.forceAuthentication' is set to 'true')
sonar.login=admin
sonar.password=admin
4、 应用Sonar-runner
前提:
4.1、Snarqube服务已开启
4.2 在工程目录下创建一个sonar-project.properties文件,内容如下
#Required metadata
sonar.projectKey=TestItem #此处设置生成Sonar报告的名字
sonar.projectName=TestItem #此处设置项目名称
sonar.projectVersion=1.1 #此处设置版本号
#Comma-separated paths to directories with sources (required)
sonar.sources=. #此处设置源码相对路径
sonar.binaries=bin\\Debug #此处设置编译生成文件的相对路径
#Language
sonar.language=cs #此处设置工程的语言类型
#Encoding of the source files
sonar.sourceEncoding=UTF-8 #此处设置编码格式
4.3 打开CMD Promat,进入到存放sonar-project.properties的目录下,输入命令
Sonar-runner
如果执行报错,想查看相关错误堆栈信息,可输入命令 Sonar-runner –e
2、 Jenkins系统管理à配置管理设置Sonarqube以及Sonar-runner的安装目录
图1
图2
3、 项目调用步骤
但就目前而言,我们需要将这些路径统一
JDK:C:\Program Files (x86)\Java\jre1.8.0_66
VS:D:\visual Studio 2012
Sonar:E:\sonarqube-5.2
Sonar-runner:E:\sonar-runner-dist-2.3
Ncover:E:\NCover3.1.2.5168
所有节点服务器上都安装job运行所需要的工具,且工具的版本以及安装目录必须一致
勾选:参数化构建过程,选择Node(自主研发的Jenkins插件)
根据自己的需求,选择适合自己的构建方式
SSH Server插件:自主研发的插件
可以在Jenkins系统管理à配置管理里面设置多个SSH Server,在项目模板中就会出现在下拉列表中,我们根据自己的需求选择使用那个SSH Server
SSH Server和 Slave相比较的优势
即使你选择了节点,我们的命令还是在SSH Server上执行的
Jenkins 部署
安装前提:系统安装有JDK安装步骤:
解压后双击安装包jenkins.msi,按照提示点击[下一步]。。。[下一步]即可
安装后查看服务管理器,新出现一个名为[Jenkins]的服务
启动服务时,可能出现端口(默认8080端口)被占用的问题,我们可通过修改配置文件的方式来修改Jenkins的端口号,配置文件路径:%jenkins_home%\jenkins.xml
<arguments>-Xrs-Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar"%BASE%\jenkins.war" --httpPort=8080</arguments>
修改后,需要重启Jenkins服务
Jenkins 常用模块
系统管理à配置管理
此模块主要设置全局环境变量或者工具相关的安装路径,以便项目中调用系统管理à节点管理
此模块主要是设置执行机器(测试机)的相关信息每个机器是一个节点(slave),可以和Jenkins的构建机器发生通讯
我们需要在多少个机器上测试,就需要创建多少个节点。
系统管理à插件管理
此模块主要是安装Jenkins相关插件,可以查看我们已安装的插件、需要更新的插件以及未安装的插件,也可选择自主研发的插件其他相关使用操作,详见$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/Jenkins使用文档.docx
Sonarqube部署
官网下载:http://www.sonarqube.org/downloads这个链接下不仅有Sonar服务器的安装包还有相关插件的下载
已下载的sonar 相关产品的TFS路径:
$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/sonarqube-5.2.zip
安装前提:
1、 存在一个Sonar的数据库
2、 系统安装有JDK
安装步骤:
1、 解压
2、 设置配置文件%Sonarqube_home%\conf\sonar.properties
2.1、设置数据库连接账号和密码
#--------------------------------------------------------------------------------------------------
# DATABASE
#
# IMPORTANT: the embedded H2database is used by default. It is recommended for tests but not for
# production use. Supporteddatabases are MySQL, Oracle, PostgreSQL and Microsoft SQLServer.
# User credentials.
# Permissions to createtables, indices and triggers must be granted to JDBC user.
# The schema must be createdfirst.
sonar.jdbc.username=sa
sonar.jdbc.password=sa
2.2、设置数据库连接字符串
根据自己的数据库类型(MySQL/ Oracle/PostgreSQL/SQLServer/)选择放开哪一部分,以SQLServer为例
#----- Microsoft SQLServer 2008/2012/2014 and SQL Azure
# A database named sonar must exist and its collation must becase-sensitive (CS) and accent-sensitive (AS)
# Use the following connection string if you want to use integratedsecurity with Microsoft Sql Server
# Do not set sonar.jdbc.username or sonar.jdbc.password property if youare using Integrated Security
# For Integrated Security to work, you have to download the MicrosoftSQL JDBC driver package from
#http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
# and copy sqljdbc_auth.dll to your path. You have to copy the 32 bit or64 bit version of the dll
# depending upon the architecture of your server machine.
# This version of SonarQube has been tested with Microsoft SQL JDBCversion 4.1
#sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar;integratedSecurity=true
# Use the following connection string if you want to use SQL Auth whileconnecting to MS Sql Server.
# Set the sonar.jdbc.username and sonar.jdbc.password appropriately.
sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=sonar
2.3、
根据需求设置Connection pool settings
#----- Connection pool settings
# The maximum number of active connections that can be allocated
# at the same time, or negative for no limit.
# The recommended value is 1.2 * max sizes of HTTP/HTTPS pools. Forexample if both HTTP and
# HTTPS ports are enabled with default sizes (50, see propertiessonar.web.http.maxThreads
# and sonar.web.https.maxThreads) then sonar.jdbc.maxActive should be1.2 * (50 + 50) = 120.
# sonar.jdbc.maxActive=60
# The maximum number of connections that can remain idle in the
# pool, without extra ones being released, or negative for no limit.
# sonar.jdbc.maxIdle=5
# The minimum number of connections that can remain idle in the pool,
# without extra ones being created, or zero to create none.
# sonar.jdbc.minIdle=2
# The maximum number of milliseconds that the pool will wait (when there
# are no available connections) for a connection to be returned before
# throwing an exception, or <= 0 to wait indefinitely.
# sonar.jdbc.maxWait=5000
# sonar.jdbc.minEvictableIdleTimeMillis=600000
# sonar.jdbc.timeBetweenEvictionRunsMillis=30000
2.4、
设置WEB SERVER
# WEB SERVER
# Web server is executed in a dedicated Java process. By default heapsize is 768Mb.
# Use the following property to customize JVM options.
# Recommendations:
#
# The HotSpot Server VM isrecommended. The property -server should be added if server mode
#isnotenabledbydefaultonyourenvironment:http://docs.oracle.com/javase/7/docs/technotes/gui#des/vm/server-class.html
#sonar.web.javaOpts=-Xmx768m-Xms256m-XX:MaxPermSize=160m-XX:+HeapDumpOnOutOfMe#moryError-Djava.net.preferIPv4Stack=true
# Same as previous property, but allows to not repeat all other settingslike -Xmx
#sonar.web.javaAdditionalOpts=
# Binding IP address. For servers with more than one IP address, thisproperty specifies which
# address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with theserver.
sonar.web.host=192.168.1.189
# Web context. When set, it must start with forward slash (for example/sonarqube).
# The default value is root context (empty value).
#sonar.web.context=sonar.web.host/port/context
#sonar.web.context=sonar.web.host/9000/context
# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=9000
3、 启动Sonarqube
执行%Sonarqube_home%目录下的StartSonar.bat
另外,可以安装Sonar相关插件,比如中文插件,C#插件等,具体安装方法是下载插件的jar文件,将其放置在%sonar_home%\extensions\plugins下,重启Sonar即可
目前已下载的相关插件存储路径:$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/sonarqube插件
Sonar-Runner部署
安装包路径:$/Centaur/产品研发中心/01部门/05验收部/09自动化测试/00_测试工具/自动化部署工具/Jenkins/sonar-runner-dist-2.3.zip
安装前提:已安装Sonarqube
安装步骤:
1、 将文件解压到本地目录
2、 设置环境变量
2.1 新增环境变量[SONAR_RUNNER_HOME]=[安装路径]
2.2 编辑环境变量[path]
追加[;%SONAR_RUNNER_HOME%\bin]
3、 编辑sonar-runner.properties,根据实际情况选择放开注释
#Configurehere general information about the environment, such as SonarQube DB detailsfor example
#Noinformation about specific project should appear here
#-----Default SonarQube server
sonar.host.url=http://192.168.1.189:9000
#-----PostgreSQL
#sonar.jdbc.url=jdbc:postgresql://localhost/sonar
#-----MySQL
#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
#-----Oracle
#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE
#-----Microsoft SQLServer
sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor
#-----Global database settings
sonar.jdbc.username=sa
sonar.jdbc.password=sa
#-----Default source code encoding
sonar.sourceEncoding=UTF-8
#-----Security (when 'sonar.forceAuthentication' is set to 'true')
sonar.login=admin
sonar.password=admin
4、 应用Sonar-runner
前提:
4.1、Snarqube服务已开启
4.2 在工程目录下创建一个sonar-project.properties文件,内容如下
#Required metadata
sonar.projectKey=TestItem #此处设置生成Sonar报告的名字
sonar.projectName=TestItem #此处设置项目名称
sonar.projectVersion=1.1 #此处设置版本号
#Comma-separated paths to directories with sources (required)
sonar.sources=. #此处设置源码相对路径
sonar.binaries=bin\\Debug #此处设置编译生成文件的相对路径
#Language
sonar.language=cs #此处设置工程的语言类型
#Encoding of the source files
sonar.sourceEncoding=UTF-8 #此处设置编码格式
4.3 打开CMD Promat,进入到存放sonar-project.properties的目录下,输入命令
Sonar-runner
如果执行报错,想查看相关错误堆栈信息,可输入命令 Sonar-runner –e
Sonar集成到Jenkins
1、 Jenkins系统管理à插件管理安装 SonarQube Plugin插件2、 Jenkins系统管理à配置管理设置Sonarqube以及Sonar-runner的安装目录
图1
图2
3、 项目调用步骤
Jenkins使用规范
为了使同一个项目可以在多个任务节点上执行,我们需要所有节点上工具的安装路径和版本都必须统一,后续我们考虑一键安装这些文件,这些规范也就不用考虑了但就目前而言,我们需要将这些路径统一
JDK:C:\Program Files (x86)\Java\jre1.8.0_66
VS:D:\visual Studio 2012
Sonar:E:\sonarqube-5.2
Sonar-runner:E:\sonar-runner-dist-2.3
Ncover:E:\NCover3.1.2.5168
Jenkins 集群部署
前提条件:所有节点服务器上都安装job运行所需要的工具,且工具的版本以及安装目录必须一致
勾选:参数化构建过程,选择Node(自主研发的Jenkins插件)
根据自己的需求,选择适合自己的构建方式
SSH Server插件:自主研发的插件
可以在Jenkins系统管理à配置管理里面设置多个SSH Server,在项目模板中就会出现在下拉列表中,我们根据自己的需求选择使用那个SSH Server
SSH Server和 Slave相比较的优势
即使你选择了节点,我们的命令还是在SSH Server上执行的
相关文章推荐
- windows使用jenkins部署到centos总结
- Jenkins修改端口和windows下部署命令以及jenkis不是外部命令
- Jenkins实现测试环境到生产环境一键部署(Windows)
- Windows环境下jenkins配置自动化部署
- Jenkins 的部署(Windows)
- 持续集成之 Jenkins 通过 Deploy 插件热部署 java 程序(九)
- 关于在windows下部署发布QT程序的总结
- 关于在windows下部署发布QT程序的总结
- jenkins 自动部署-windows下的-学习笔记 ( 一 )
- PXE+RIS批量部署windows系统实践心得总结
- 最常用的jenkins插件总结(不包括默认安装的)
- 一步步部署基于Windows系统的Jenkins持续集成环境
- 干货分享:vue2.0做移动端开发用到的相关插件和经验总结(2)
- jenkins使用git SCM时changelog乱码(Jenkins部署在Linux上,任务在Windows Slave上构建)
- Windows防火墙出站、入站相关知识总结
- PXE+RIS批量部署windows系统实践心得总结
- 关于在windows下部署发布QT程序的总结
- Windows编程-1-字符和字符串处理相关知识点总结
- 电商之梳理jenkins相关知识---web部署工具
- 在Windows下部署QT程序的总结