jenkins, git, maven, sonarqube integrated, automated deployment scan code

As a relatively small exposure to people deployed, this document should help to everyone. . . Stepped pit too, it is a technical operation and maintenance

1. Deploy sonarqube

The preferred sonarqube, lazy choose to deploy docker

docker run -d --name sonarqube -p 8100:9000 -p 8111:9092 --link=citydo-mysql:mysql -e SONARQUBE_JDBC_USERNAME=root -e SONARQUBE_JDBC_PASSWORD=mCEVgbZv2V0z -e SONARQUBE_JDBC_URL="jdbc:mysql://ip:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false" sonarqube

  Login account: admin password: admin

 Installation sonar scnaner: sonar-scanner-3.3

 Modify the configuration file:


sonar.sourceEncoding=UTF-8
sonar.jdbc.username=sonar
sonar.jdbc.password=mCEVgbZv2V0z
sonar.jdbc.url=jdbc:mysql://47.110.252.194:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.login=admin
sonar.password=admin

2. Deploy Jenkins 

1. Install git  

yum install git 

Docker can be installed, but later, in the configuration git, maven when more trouble, because docker virtual container file needs to be mapped, so the best way is to

 wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo


yum install jenkins

 

  Obtaining initial password

  cat /var/lib/jenkins/secrets/initialAdminPassword   

 vi /etc/rc.d/init.d/jenkins, add the Java installation path

systemctl start jenkins

 

Plug: System Management -> Plugin Manager

1.git parameter

2.GitHub Integration Plugin

3.Maven Release Plug-in Plug-in

4.Publish Over SSH

5. sonarqube Scanner   2.8, (the default version 2.9 there is a problem)

Links: https://pan.baidu.com/s/1-yRyPg43ZSRcaJC7k3Q1zg extraction code: fa96

System Management - "System Settings global path settings

SonarQube servers:

SSH Servers:

System Management --- "Global tool settings:

git   ,maven ,jdk ,sonarqube ,

 


 

 

4. Configure maven project

 

2. Source Management:

  由于,我的代码和jenkins 服务器在同一个服务器上,所以直接执行shell 命令,如果是不在一个服务上,则是执行ssh 发送文件

 

 

 

   

 

 

 

Guess you like

Origin blog.csdn.net/yss1019/article/details/91048120