Felipe Paulo
Felipe Paulo

Reputation: 45

Pipeline on Devops with SonarQube gets "Could not find target branch"

I tried a Pull Request and i triggered the pipeline before complete de merge, but I got the followed log

{"task":{"id":"AXuKvrZjTmGb5CxwFPXc","type":"REPORT","componentId":"AXuKvrZYTmGb5CxwFPXb","componentKey":"Portal.API","componentName":"Portal.API","componentQualifier":"TRK","status":"FAILED","submittedAt":"2021-08-28T03:12:39+0000","submitterLogin":"[email protected]","startedAt":"2021-08-28T03:12:39+0000","executedAt":"2021-08-28T03:12:39+0000","executionTimeMs":30,"logs":false,"errorMessage":"Could not find target branch 'null' in project","hasScannerContext":true,"pullRequest":"198","warningCount":0,"warnings":[]}}

enter image description here

anyone have a suggestion?

Upvotes: 1

Views: 2558

Answers (2)

Q.CY
Q.CY

Reputation: 31

For me, I find that the branch here should be set to be the same (name) as your PR's target branch name:

and then, when your PR is successfully scanned, it will show like this

Upvotes: 2

Kevin Lu-MSFT
Kevin Lu-MSFT

Reputation: 35184

In Prepare Analysis Configuration task, you can try to add the following Properties.

sonar.pullrequest.vsts.instanceUrl = https://dev.azure.com/org/
sonar.pullrequest.vsts.project= Projectname
sonar.pullrequest.vsts.repository =reponame

enter image description here

This will help sonarqube to determine the Pull Reuqest in Azure DevOps.

Upvotes: 0

Related Questions