Multi jobs failing SonarQube analysis and MsBuild in Azure DevOps build pipeline

1.8k Views Asked by At

in an Azure DevOps build pipeline, I would like to run a MsBuild task in an Azure hosted agent and a sonar analysis task in a self-hosted agent.

I understand that I need to pass artifacts from a job to another. I try to use Publish and Download pipeline artifact tasks for this purpose.

  1. First, I prepare SonarQube analysis on a self-hosted agent
  2. then I publish the .sonarqube folder
  3. On a Microsoft hosted agent I download the previously published SonarQube metadata to the job
  4. I run MsBuild and test tasks
  5. I publish test results
  6. Back on the self-hosted agent I download SonarQube metadata and test results
  7. I run SonarQube analysis

The following error message shows during the SonarQube analysis task execution.

##[error][SQ] The 'Prepare Analysis Configuration' task was not executed prior to this task

Here is how I proceed

On Self-hosted agent job "PrepareSonarqube"

  • Prepare Sonarqube analysis

Prepare Sonarqube analysis (on self-hosted agent job)

  • Publish pipeline artifact $(Pipeline.Workspace)/.sonarqube folder

Publish pipeline artifact <code>$(Pipeline.Workspace)/.sonarqube</code> folder (on self-hosted agent job)

On Microsoft hosted agent job "Build"

  • Msbuild and test tasks

Msbuild and test tasks (on Microsoft hosted agent job)

  • Publish pipeline artifact "TestResults" folder

Publish pipeline artifact TestResults folder (on Microsoft hosted agent job)

On self-hosted agent job "SonarQube Analysis"

  • Download pipeline artifact ".sonarqube" folder

Download pipeline artifact .sonarqube (on self-hosted agent job)

  • Download pipeline artifact "TestResults"

Download pipeline artifact TestResults (on self-hosted agent job)

0

There are 0 best solutions below