为什么 Jenkins 会因 SonarQube 和 GitLab 插件的“PKIX 路径构建失败”而失败?
我找到了这篇文章:https : //support.cloudbees.com/hc/en-us/articles/217078498-PKIX-path-building-failed-error-message
然而,它似乎并没有完全回答这个问题。
堆栈跟踪的两部分:
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
和
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
将 Jenkins 配置为与 GitLab 和 SonarQube 一起使用时,JVM 需要知道服务器的密钥库和外部站点为其签名的证书颁发机构(信任库)以建立 SSL 连接。
在 CentOS 服务器上,在 /etc/sysconfig/jenkins 中,将以下内容添加到 JENKINS_JAVA_OPTIONS 属性中:
JENKINS_JAVA_OPTIONS="-Djavax.net.ssl.trustStore=<path to trustStore in JKS format> -Djavax.net.ssl.trustStorePassword=<password> -Djavax.ssl.keyStore=<path to server keystore in JKS format> -Djavax.net.ssl.keyStorePassword=<password>"
以上与在Jenkins中设置HTTPS不同,可以使用以下两个属性进行设置:
JENKINS_HTTPS_KEYSTORE=<path to server keystore in JKS format>
JENKINS_HTTPS_KEYSTORE_PASSWORD=<password>
JENKINS_HTTPS_PORT=<port to listen on for https>
注意:我一直回到这篇 CloudBees 文章(https://support.cloudbees.com/hc/en-us/articles/217078498-PKIX-path-building-failed-error-message)它向后获取了 keyStore 和 trustStore ,并没有说要设置它们。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句