sonar+jenkins

/ shell / 0 条评论 / 921浏览
sonar.projectBaseDir=/home/$ProjectName/$Module/
sonar.projectKey=$ProjectName-$Module-Git
sonar.projectName=$ProjectName-$Module-Git
sonar.projectVersion=1.0

sonar.modules=javascript-module,html-module 

# JavaScript module
javascript-module.sonar.projectName=JavaScript Module
javascript-module.sonar.language=js
javascript-module.sonar.sources=js
javascript-module.sonar.projectBaseDir=./
  
# Html module
html-module.sonar.projectName=Html Module
html-module.sonar.language=web
html-module.sonar.sources=./
html-module.sonar.exclusions=js/**  #,号分割多个
1. web
html-module.sonar.projectBaseDir=./

2. android
#pull
cd /home/$ProjectName/$Module/
gradle clean
git pull

cd mDM
gradle assemblestandard_noc_disableRelease

sonar.projectBaseDir=/home/$ProjectName/$Module/
sonar.projectKey=$ProjectName-$Module-Git
sonar.projectName=$ProjectName-$Module-Git
sonar.projectVersion=1.0

sonar.language=java
sonar.java.source=1.8

#sonar.profile=Android Lint
sonar.sources=./
sonar.java.binaries=./


============================================================
sonar平台搭建
1.  源文件下载
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/
http://downloads.sonarsource.com/plugins/org/codehaus/sonar-plugins/android/sonar-android-plugin/

2.  安装
sonar:
mysql: sonar Nationsky1@3
linux: sonar yhl1234/root yhl1234

1. useradd -m -g root -s /bin/bash sonar  #
2. chown -R -v sonar:root sonardir        #
3. passwd sonar
4. sonar登录 启动
9001 -es
9000 -web

conf/sonar.properties
jdbc+user+pass

问题
1>
elasticsearch process is too low, increase to at least [65536

vi /etc/security/limits.conf
sonar hard nofile 65536
sonar soft nofile 65536
需要重新login

2>max virtual memory areas vm.max_map_count [65530] is too low

vi /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p

3. jenkins插件

4. slave
gradle + maven + android
sonar-scanner



sonar pdf plugin
https://gitee.com/zzulj/sonar-pdf-plugin

问题:  Failed to upload report - 500: An error has occurred
 SHOW VARIABLES LIKE 'max_allowed_packet'; 
修改/etc/my.cnf文件:max_allowed_packet = 50M
重新服务 service mysqld restart
sonar重启  ./sonar stop | start

python更新模块
 pip3 install --upgrade setuptools 

git status  --查看是否有待提交文件
git diff      --与远程查看文件