SonarQube impacting seperate agent job?

Hi @Jody_Lester,

The scanner begin step copies files to two locations:

  1. SonarQube.Integration.ImportBefore.targets is copied to machine-wide, user-specific locations, and it will be picked up by all builds run on the machine for all agents.
  2. SonarQube.Integration.targets and its related assemblies are copied to a pipeline-specific location ([build pipeline folder]\.sonarqube\bin\targets)

Both sets of files need to be present for the Sonar analysis tasks and targets to be picked up and run as part of an MSBuild run. The error message you are seeing is coming from the SonarQube.Integration.targets file, which means that both the shared-location and pipeline-specific files are present at the point your database project is being built.

On a machine with a single build agent installed the sequence of steps would be as follows:
(1) Agent 1 starts Analysis Build X -> installs the shared targets and targets under PipelineX\.sonarqube\...
(2) Agent 1 runs MSBuild -> Sonar targets are executed
(3) Agent 1 runs analysis end step -> the targets in the shared location are deleted
(4) Agent 1 runs the Redgate DB step -> the shared targets are not on the machine -> Sonar targets are not executed, so no error.

However, if the machine has multiple build agents installed then it’s possible for the following to happen:
(3a) Agent 2 starts Analysis Build Y -> installs the shared targets and targets under PipelineY\.sonarqube\...

Then at stage (4) for Agent 1 both shared targets and those under PipelineX\.sonarqube\... are present -> Sonar targets are picked up the the Redgate DB build -> error.

Try the following: add a script step in the Build Query Intelligence Database job immediately before the Build SQL Change Automation Project Intelligence step that deletes the pipeline-specific targets in [AGENT_BUILDDIRECTORY]\.sonarqube\bin\targets.