我们正在设置jenkins +声纳+ github集成,以通过声纳自动进行pullrequest静态代码检查。
在jenkins的构建后操作中,我们具有以下属性:
-Dsonar.jacoco.itReportPath=target/coverage-reports/jacoco-ut.exec
-Dsonar.sourceEncoding=UTF-8
-Dsonar.analysis.mode=preview
-Dsonar.github.repository=gitrepo
-Dsonar.host.url=sonar URL
-Dsonar.login=sonar Username
-Dsonar.password=sonar password
-Dsonar.github.oauth= PAT who has write permission to gitHub
-Dsonar.github.pullRequest=${ghprbPullId}
-Dsonar.github.disableInlineComments=false
-Dsonar.github.endpoint=company gitHub endpoint
出于安全原因,我们不想将令牌用于参数 -Dsonar.github.oauth
如果我们不提供身份验证令牌,则声纳分析报告不会在gitHub中更新为注释。
还有其他方法可以在不使用auth令牌的情况下将声纳分析报告更新为gitHub中的注释。