Search code examples
xamarin.iossonarqube-scanvisual-studio-app-center

Appcenter iOS build fails when enabling sonarscanner


For an appcenter deployment I want to use SonarQube to analyze the code quality of the project. I have setup the appcenter-pre-build.sh and appcenter-post-build.sh scripts to install and enable Sonarscanner in the appcenter build process. Now when I build for iOS, the build process fails, because it cannot find 2 files in the /Users/runner/work/1/.sonarqube folder on the build machine. Those files are /Users/runner/work/1/.sonarqube/conf/cs/SonarLint.xml and /Users/runner/work/1/.sonarqube/conf/4/ProjectOutFolderPath.txt. I know for a fact that the /Users/runner/work/1/.sonarqube/conf/cs/SonarLint.xml is there, because in the logfile it says: "Writing Roslyn analyzer additional file to /Users/runner/work/1/.sonarqube/conf/cs/SonarLint.xml..." when running the appcenter-pre-build.sh script, which installs the sonarscanner.

I am installing the sonarscanner with the command: dotnet tool install --global dotnet-sonarscanner and the version that gets installed is 5.0.4. On my SonarQube server I am running version 8.3 community edition and when the appcenter build runs, the analysis report appears in my project on my sonarqube server. The build however fails.

Please advice on how to get the iOS builds in appcenter to succeed while sonarscanner is enabled.

Thank you in advance.


Solution

  • The problem is how appcenter logs the build process. From going through the logfiles, you get the impression that the build fails, because of the integration with Sonarqube. The build failed however, because there were some context links missing in the c# code. Once this issue was found by building locally, The builds succeeded.