ubuntu - 在 ubuntu 上无法从 Jenkins 访问 Sonarqube
问题描述
我在 AWS EC2 CentOS 实例上安装了以下内容: - Nginx - Sonarqube 服务器 - 声纳扫描仪 - 名为 Jenkins 的 SSL 证书我的声纳安装在端口 9000 上,下面是访问它的 URL,因为 SSL 证书安装在这台机器上。 https://jenkins.net/sonar/
以下是其他细节:
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# Settings for a TLS enabled server.
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;
root /usr/share/nginx/html;
ssl_certificate "/etc/nginx/ssl/jenkins.crt";
ssl_certificate_key "/etc/nginx/ssl/jenkins.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location /
{
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
# Required for new HTTP-based CLI
proxy_http_version 1.1;
proxy_request_buffering off;
}
location /nagios{
proxy_pass http://127.0.0.1:8093/nagios;
}
location /sonar{
proxy_pass http://127.0.0.1:9000/sonar;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}
Sonarqube 服务器配置文件:
#--------------------------------------------------------------------------------------------------
# WEB SERVER
# The default value is root context (empty value).
sonar.web.context=/sonar
# TCP port for incoming HTTP connections. Default value is 9000.
#sonar.web.port=9000
声纳扫描仪配置文件:
sonar.host.url=https://jenkins.net/sonar
在这里,我尝试了以下所有内容,例如:
sonar.host.url=http://jenkins.net/sonar
and
sonar.host.url=http://<my_ip_addr>/sonar
但是在所有情况下,我都面临以下问题:
[CS_Sonar] $ /opt/sonar_scanner/bin/sonar-scanner -Djavax.net.ssl.trustStore=/usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.debug=ssl,handshake -Dsonar.host.url=https://jenkins.net/dde/sonar ******** -Dproject.settings=/home/ubuntu/workspace/CS_Sonar/sonar.properties -Dsonar.projectBaseDir=/home/ubuntu/workspace/CS_Sonar
INFO: Scanner configuration file: /opt/sonar_scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/ubuntu/workspace/CS_Sonar/sonar.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-1032-aws amd64
INFO: User cache: /home/ubuntu/.sonar/cache
ERROR: SonarQube server [https://jenkins.net/dde/sonar] can not be reached
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.333s
INFO: Final Memory: 5M/241M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to execute SonarQube
ERROR: Caused by: Fail to get bootstrap index from server
ERROR: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ERROR: Caused by: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ERROR: Caused by: unable to find valid certification path to requested target
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
ERROR: SonarQube scanner exited with non-zero code: 1
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
你们中的任何人都可以帮忙吗?谢谢!
解决方案
推荐阅读
- django - Django中的页面范围变量
- c++ - 在源文件中声明函数模板时是否应该防止 ODR 违规?
- c# - 在 TextBox 控件的选择周围插入文本
- python - 无需任何外部库的 Python 图像裁剪
- python - Opencv轮廓区域返回错误结果
- uiveri5 - 如何使用 uiveri5 创建 util 文件?
- c# - 有没有办法使用 C# 将动态数据输入到 lua 脚本中?
- asp.net-core - 将 Hangfire UI 设置为默认页面 ASPNET Core MVC
- python - 如何使用 import_module 导入模块以解决测试代码中的“ModuleNotFoundError”
- azure - Arm 模板 - 在请求中发现错误的 JSON 内容