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.
- First, I prepare SonarQube analysis on a self-hosted agent
- then I publish the
.sonarqube
folder - On a Microsoft hosted agent I download the previously published SonarQube metadata to the job
- I run MsBuild and test tasks
- I publish test results
- Back on the self-hosted agent I download SonarQube metadata and test results
- 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
- Publish pipeline artifact
$(Pipeline.Workspace)/.sonarqube
folder
On Microsoft hosted agent job "Build"
- Msbuild and test tasks
- Publish pipeline artifact "TestResults" folder
On self-hosted agent job "SonarQube Analysis"
- Download pipeline artifact ".sonarqube" folder
- Download pipeline artifact "TestResults"