Jenkins集成sonarQube 8.2

Posted nhz-m

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jenkins集成sonarQube 8.2相关的知识,希望对你有一定的参考价值。

目录准备

  • mkdir -p /home/jenkins_root/sonarQube/{sonarqube_data,sonarqube_extensions,sonarqube_logs,conf}

  • mkdir -p /home/jenkins_root/sonarQube/postgreSQL_data

目录说明

sonarqube_data – contains data files, such as the embedded H2 database and Elasticsearch indexes
sonarqube_logs – contains SonarQube logs about access, web process, CE process, and Elasticsearch
sonarqube_extensions – contains plugins, such as language analyzers

镜像准备更多参数配置

FROM sonarqube:8.2-community
COPY /home/jenkins_root/sonarQube/conf/sonar.properties  /opt/sonarqube/conf/
  • $ docker build --tag=sonarqube-custom .
  • $ docker run -ti sonarqube-custom

[^避免暴力停止容器导致任务终端 --stop-timeout 3600 (延迟关闭容器)]

version: '2.4'
services:
  postgres:
    image: "postgres" 
    restart: always 
    ports: 
     - "9000:9000"
  sonar:
    image: "sonarqube:lastest"
    restart: always
    ports:
     - "9000:9000"
     - "9092:9092"
    volumes:
     - "/home/jenkins_root/jenkins_install_dir:/var/jenkins_home"
     - "/home/jenkins_root/sonarQube/sonarqube_data:/opt/sonarqube/data"
     - "/home/jenkins_root/sonarQube/sonarqube_extensions:/opt/sonarqube/extensions"
     - "/home/jenkins_root/sonarQube/sonarqube_logs:/opt/sonarqube/logs"
    environment:
     - sonar.jdbc.url=jdbc:sqlserver://localhost;databaseName=cloudnet
     - sonar.jdbc.url=jdbc:username:eccom
     - sonar.jdbc.url=jdbc:password:eccom   
    network_mode: "host"
    cpus: 1
    mem_limit: 2g
    depends_on:
     - postgres

loading...

以上是关于Jenkins集成sonarQube 8.2的主要内容,如果未能解决你的问题,请参考以下文章

jenkins集成sonarqube代码审核

30-Jenkins-集成SonarQube检测代码质量

利用Jenkins和SonarQube集成对代码进行持续检测

Jenkins集成Sonarqube

jenkins集成sonarQube实现代码质量检查

Jenkins集成SonarQube实现代码质量检查