在执行与Jenkins集成的SonarScanner分析时,在控制台输出中会提示显示以下消息:
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3:33.658s
INFO: Final Memory: 5M/24M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.scanner.scan.ProjectConfiguration
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.ProjectServerSettings
ERROR: Caused by: Fail to request http://sonarqube:9000/sonarqube/api/settings/values.protobuf?component=AplicacaoTeste
ERROR: Caused by: timeout
ERROR: Caused by: Read timed out我在Jenkins和SonarQube上都用Docker
来自sonar.properties的自定义值:
sonar.jdbc.username=YYYY
sonar.jdbc.password=XXXX
sonar.jdbc.url=jdbc:postgresql://sonarqube_db:5432/YYYY
sonar.jdbc.maxActive=1000
sonar.jdbc.maxIdle=8
sonar.jdbc.minIdle=4
sonar.jdbc.maxWait=0
sonar.web.host=0.0.0.0
sonar.web.context=/sonarqube
sonar.web.port=9000码头工人撰写文件:
version: "3.7"
services:
jenkins:
image: jenkins/jenkins:lts-jdk11
container_name: jenkins-container
restart: always
labels:
br.com.topfornecedores.descricao: "Jenkins CI/CD"
networks:
- software_qa
volumes:
- ./Jenkins/volumes/home:/var/jenkins_home
expose:
- 8080
- 50000
ports:
- 8088:8080
- 50055:50000
depends_on:
- sonarqube
sonarqube_db:
build: ./SonarQube_PostgreSQL
container_name: sonarqube_db-container
restart: always
labels:
br.com.topfornecedores.descricao: "Banco de dados do SonarQube"
volumes:
- postgresql-volume:/var/lib/postgresql/data
expose:
- 5432
ports:
- 5432:5432
networks:
- software_qa
healthcheck:
test: ["CMD", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
sonarqube:
build: ./SonarQube
container_name: sonarqube-container
restart: always
labels:
br.com.topfornecedores.descricao: "SonarQube análises de qualidade de código e segurança"
volumes:
- "./SonarQube/volumes/conf:/opt/sonarqube/conf"
- "./SonarQube/volumes/data:/opt/sonarqube/data"
- "./SonarQube/volumes/logs:/opt/sonarqube/log"
environment:
- SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube_db:5432/sonardb
- SONARQUBE_JDBC_USERNAME=sonarusuario
- SONARQUBE_JDBC_PASSWORD=sonarusuariosenha
expose:
- 9000
ports:
- 9000:9000
- 9002:9002
depends_on:
- sonarqube_db
networks:
- software_qa
networks:
software_qa:
driver: "bridge"
volumes:
postgresql-volume:
name: postgresql-volume我可以在浏览器中访问URL:http://sonarqube:9000/sonarqube/api/settings/values.protobuf?component=AplicacaoTeste,这样就可以了。
版本
SonarQube: 7.9.1
SonarScanner Jenkins插件: 2.6.1
詹金斯: lts-jdk11 11
Docker Windows桌面:2
这个错误是为什么造成的?
发布于 2019-09-09 17:16:01
您的DB容器在docker-组合中是不同的,并且在URL中是不同的,这就是为什么您需要超时。
sonarqube_db:
build: ./SonarQube_PostgreSQL
container_name: sonarqube_db-container因为错误日志是
http://sonarqube:9000/sonarqube/api/settings/values.protobuf?component=AplicacaoTeste错误:由:超时值`引起
你需要更新
SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube_db:5432/sonardb至
SONARQUBE_JDBC_URL=jdbc:postgresql://sonarqube_db-container:5432/sonardb对于sonarqube,您将为容器指定一个名称,因此当您想要从其他容器访问时,应该使用sonarqube-container。
sonarqube:
build: ./SonarQube
container_name: sonarqube-container喜欢
ERROR: Caused by: Fail to request http://sonarqube:9000/sonarqube/api/settings/values.protobuf?component=AplicacaoTeste将此更改为
http://sonarqube-container:9000/sonarqube/api/settings/values.protobuf?component=AplicacaoTestehttps://stackoverflow.com/questions/57857270
复制相似问题