简体   繁体   English

Mac中的声纳扫描仪分析失败

[英]Sonar scanner in Mac failing analysis

I am tyring to scan swift code in Sonarqube. 我打算在Sonarqube中扫描快速代码。 We have a proxy and I believe that is the root cause of this error. 我们有一个代理,我相信这是此错误的根本原因。

I have set http_proxy,https_proxy and no_proxy env variables in ~/.bash_profile in mac machine. 我在Mac机器的〜/ .bash_profile中设置了http_proxy,https_proxy和no_proxy env变量。

I have setup project and sonar scanner in Mac node (via Jenkins) 我在Mac节点中有安装项目和声纳扫描仪(通过Jenkins)

iOS project build is working fine. iOS项目构建正常。

When sonar scan step runs, I am getting this error. 运行声纳扫描步骤时,出现此错误。 Any idea why this is occuring? 知道为什么会这样吗?

16:53:39 Unpacking https://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/3.0.3.778/sonar-scanner-cli-3.0.3.778.zip to /Users/jenkins/home/jenkinsdata/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarqubeScanner on Mac-Agent
16:53:39 ERROR: Failed to download https://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/3.0.3.778/sonar-scanner-cli-3.0.3.778.zip from agent; will retry from master
16:53:39 java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
16:53:39    at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2124)
16:53:39    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
16:53:39    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
16:53:39    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
16:53:39    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
16:53:39    at java.net.URL.openStream(URL.java:1045)
16:53:39    at hudson.FilePath$Unpack.invoke(FilePath.java:867)
16:53:39    at hudson.FilePath$Unpack.invoke(FilePath.java:861)
16:53:39    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2750)
16:53:39    at hudson.remoting.UserRequest.perform(UserRequest.java:153)
16:53:39    at hudson.remoting.UserRequest.perform(UserRequest.java:50)
16:53:39    at hudson.remoting.Request$2.run(Request.java:336)
16:53:39    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
16:53:39    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
16:53:39    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
16:53:39    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
16:53:39    at hudson.remoting.Engine$1$1.run(Engine.java:94)
16:53:39    at java.lang.Thread.run(Thread.java:748)
16:53:39    at ......remote call to JNLP4-connect connection from macHost/macHost:49506(Native Method)
16:53:39    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1554)
16:53:39    at hudson.remoting.UserResponse.retrieve(UserRequest.java:281)
16:53:39    at hudson.remoting.Channel.call(Channel.java:839)
16:53:39    at hudson.FilePath.act(FilePath.java:987)
16:53:39 Caused: java.io.IOException: remote file operation failed: /Users/jenkins/home/jenkinsdata/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarqubeScanner at hudson.remoting.Channel@45df1f9e:JNLP4-connect connection from macHost/macHost:49506
16:53:39    at hudson.FilePath.act(FilePath.java:994)
16:53:39    at hudson.FilePath.act(FilePath.java:976)
16:53:39    at hudson.FilePath.installIfNecessaryFrom(FilePath.java:831)
16:53:39    at hudson.FilePath.installIfNecessaryFrom(FilePath.java:764)
16:53:39    at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:77)
16:53:39    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:72)
16:53:39    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
16:53:39    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
16:53:39    at hudson.plugins.sonar.SonarRunnerInstallation.forNode(SonarRunnerInstallation.java:104)
16:53:39    at hudson.plugins.sonar.SonarRunnerInstallation.forNode(SonarRunnerInstallation.java:62)
16:53:39    at hudson.plugins.sonar.utils.BuilderUtils.getBuildTool(BuilderUtils.java:70)
16:53:39    at hudson.plugins.sonar.SonarRunnerBuilder.perform(SonarRunnerBuilder.java:279)
16:53:39    at hudson.plugins.sonar.SonarRunnerBuilder.perform(SonarRunnerBuilder.java:261)
16:53:39    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
16:53:39    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:736)
16:53:39    at hudson.model.Build$BuildExecution.build(Build.java:206)
16:53:39    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
16:53:39    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:496)
16:53:39    at hudson.model.Run.execute(Run.java:1737)
16:53:39    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
16:53:39    at hudson.model.ResourceController.execute(ResourceController.java:97)
16:53:39    at hudson.model.Executor.run(Executor.java:419)

Update 1 更新1
I added Mac machine to no_proxy list in Jenkins. 我将Mac机添加到Jenkins的no_proxy列表中。 Now the above error is gone, but getting this below error. 现在,上面的错误消失了,但是得到了下面的错误。

I opened sonarqube server in a browser and tested using curl like curl sonarqubeserverIP:9000 and both works fine. 我在浏览器中打开了sonarqube服务器,并使用curl sonarqubeserverIP:9000之类的curl进行了测试,两者都可以正常工作。

I am able to do analysis for other projects from windows and linux machines on same server. 我能够从同一服务器上的Windows和Linux机器对其他项目进行分析。

09:51:24 INFO: SonarQube Scanner 3.0.3.778
09:51:24 INFO: Java 1.8.0_144 Oracle Corporation (64-bit)
09:51:24 INFO: Mac OS X 10.12.6 x86_64
09:51:24 INFO: User cache: /Users/jenkins/.sonar/cache
09:51:24 ERROR: SonarQube server [http://SonarserverIP:9000] can not be reached
09:51:24 INFO: ------------------------------------------------------------------------
09:51:24 INFO: EXECUTION FAILURE
09:51:24 INFO: ------------------------------------------------------------------------
09:51:24 INFO: Total time: 0.411s
09:51:24 INFO: Final Memory: 4M/245M
09:51:24 INFO: ------------------------------------------------------------------------
09:51:24 ERROR: Error during SonarQube Scanner execution
09:51:24 org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
09:51:24    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
09:51:24    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
09:51:24    at java.security.AccessController.doPrivileged(Native Method)
09:51:24    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
09:51:24    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
09:51:24    at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
09:51:24    at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
09:51:24    at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
09:51:24    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
09:51:24 Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
09:51:24    at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:100)
09:51:24    at org.sonarsource.scanner.api.internal.Jars.getScannerEngineFiles(Jars.java:76)
09:51:24    at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
09:51:24    at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
09:51:24    at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
09:51:24    ... 8 more
09:51:24 Caused by: java.lang.IllegalStateException: Status returned by url [http://SonarserverIP:9000/batch/index] is not valid: [403]
09:51:24    at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:115)
09:51:24    at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:98)
09:51:24    at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:96)
09:51:24    ... 12 more
09:51:24 ERROR: 
09:51:24 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Thanks in advance. 提前致谢。

It looks like that you have to go through a authenticating proxy when accessing Maven Central to download SonarQube scanner with Jenkins. 看起来,访问Maven Central以使用Jenkins下载SonarQube扫描仪时,您必须通过身份验证代理。

To solve your issue you need to configure Jenkins with your credentials and proxy configuration. 要解决您的问题,您需要使用凭据和代理配置来配置Jenkins。 You will find more details here : https://wiki.jenkins.io/display/JENKINS/JenkinsBehindProxy 您可以在这里找到更多详细信息: https : //wiki.jenkins.io/display/JENKINS/JenkinsBehindProxy

According to your update 1, SonarQube is returning a 403 http code indicating that the credential you are using seems to be incorrect. 根据您的更新1,SonarQube返回的403 http代码表明您使用的凭据似乎不正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM