Azure Devops Pipeline multiple jobs

Hi all,

I’m having a problem in our pipeline setup, where we need to use multiple jobs to switch between a self-hosted agent (for SonarQube) and a Microsoft-hosted agent.

Here’s our pipeline structure:
Jobs:
-job* SonarQubePrepare (Self-hosted agent for SonarQube)
-job* BuildAndAnalyze (Microsoft-hosted agent)
-job* SonarQubeAnalysis (Self-hosted agent for SonarQube)
-job* PublishArtifacts (Microsoft-hosted agent)

We’re seeing the following error during the SonarQubeAnalyze step:

##[error]Variables are missing. Please make sure that you are running the Prepare task before running the Analyze task.

I’m using SonarQube on-premises. Any help is appreciated.

thank you.

Make sure you are not mixing tasks from different major versions. If you are using a multistage pipeline, make sure the tasks are in the same stage.

Unfortunately, SonarQube works only in one job - an old problem for us too. We have integration tests running in a different stage and therefore the test coverage of these tests are not reported.

It’s not your setup, but see e.g. this old topic Provide test results from multiple steps - #3 by milbrandt

The only chance I see is that you have all 3 Sonar-Tasks in each of your jobs where you want to report and open your self-hosted SonarQube instance for trafic from the Microsoft-hosted build agent IP ranges.