Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/platform-bi-web

zhuth 7 years ago
parent
commit
2523203e3b
5 changed files with 31 additions and 1 deletions
  1. 2 0
      .gitignore
  2. 9 1
      Dockerfile
  3. 6 0
      Jenkinsfile
  4. 3 0
      sonar-project.properties
  5. 11 0
      sonar-runner.properties

+ 2 - 0
.gitignore

@@ -2,3 +2,5 @@ dist
 node_modules
 .DS_Store
 *.css
+.scannerwork/.sonar_lock
+.scannerwork/report-task.txt

+ 9 - 1
Dockerfile

@@ -7,8 +7,16 @@
 FROM ubuntu
 # File Author / Maintainer
 # MAINTAINER name Chunteng Xiao
+RUN apt-get clean
 RUN apt-get update
-RUN apt-get install -y nodejs nginx npm
+RUN apt-get -f install -y nodejs nginx npm curl unzip
+RUN curl --insecure -o ./sonarscanner.zip -L https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
+RUN unzip sonarscanner.zip
+RUN rm sonarscanner.zip
+ENV SONAR_RUNNER_HOME=/sonar-scanner-3.2.0.1227-linux
+ENV PATH $PATH:/sonar-scanner-3.2.0.1227-linux/bin
+COPY sonar-runner.properties ./sonar-scanner-3.2.0.1227-linux/conf/sonar-scanner.properties
+CMD sonar-scanner
 RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
 ADD default /etc/nginx/sites-available
 EXPOSE 80

+ 6 - 0
Jenkinsfile

@@ -7,6 +7,12 @@ pipeline {
         }
     }
     stages {
+        stage('SonarQube Analysis') {
+            steps {
+                sh 'sonar-scanner'
+            }
+        }
+
         stage('Build'){
             steps {
                 sh 'npm install'

+ 3 - 0
sonar-project.properties

@@ -0,0 +1,3 @@
+sonar.projectKey=BI-web
+sonar.sources=/var/jenkins_home/workspace/bi-web/src
+sonar.login=23d8e28c74cffc70119fb26cf893dd6044440b33

+ 11 - 0
sonar-runner.properties

@@ -0,0 +1,11 @@
+#Configure here general information about the environment, such as SonarQube DB details for example
+#No information about specific project should appear here
+
+#----- Default SonarQube server
+sonar.host.url=http://192.168.253.189:9000
+
+#----- Default source code encoding
+sonar.sourceEncoding=UTF-8
+sonar.projectKey=BI-web
+sonar.sources=./src/
+sonar.login=23d8e28c74cffc70119fb26cf893dd6044440b33