Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube "Failed to create an empty directory" when scanning multiple projects in one VSTS build definition

I need to run sonarqube for multiple projects in a nightly build definition. The problem I found is - after successfully run sonarqube for the first project, a .sonarqube folder is created and a process seems keep using the folder. As a result, the folder cannot be deleted / used by subsequent projects. Is there a way to solve this?

enter image description here

Error in the prepare step of 2nd project:

2017-06-08T22:43:53.0910761Z ##[error]Failed to create an empty directory 'C:\VSTS-Agent-2.104.0\_work\3\.sonarqube'. Please check that there are no open or read-only files in the directory and that you have the necessary read/write permissions.
2017-06-08T22:43:53.0910761Z ##[error]Detailed error message: The process cannot access the file 'newSummaryReport.md' because it is being used by another process.
2017-06-08T22:43:53.0910761Z ##[error]Pre-processing failed. Exit code: 1
2017-06-08T22:43:53.0910761Z ##[error]System.Exception: Unexpected exit code received from batch file: 1
2017-06-08T22:43:53.0910761Z    at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeBatchScriptCmdlet.ProcessRecord()
2017-06-08T22:43:53.0910761Z    at System.Management.Automation.CommandProcessor.ProcessRecord()
2017-06-08T22:43:53.1066882Z ##[error]PowerShell script completed with 1 errors.
like image 454
Tommy Tang Avatar asked Jun 08 '17 23:06

Tommy Tang


1 Answers

I bypass this issue:

  • by adding a delete file task to pipeline before "Prepare analysis on SonarQube" task;
  • delete ".sonarqube\out\" folder. Source folder "$(Agent.BuildDirectory)\.sonarqube\out\";
  • be sure to check "Remove files starting with a dot" in advance.
like image 155
Engin Ahmet Bodur Avatar answered Sep 23 '22 06:09

Engin Ahmet Bodur