SonarCloudAnalyze@1 task in Azure DevOps is giving us a 404 when running a build pipeline for a Pull Request. The build runs successfully for the branch itself or for the main branch. Only PR runs are failing.
The PR analyze was working until the 25th of November. After that date, the Analyze step stopped working.
The PAT token is already newly created and has Code - Read&write permissions.
Output:
10:32:37.640 DEBUG: Found manual configuration of branch/PR analysis. Skipping automatic configuration.
10:32:38.353 DEBUG: GET 404 https://sonarcloud.io/api/alm_integration/show_pullrequest?project=***&pullrequestKey=103 | time=712ms
##[error]10:32:38.422 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
10:32:38.422 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
...
Caused by: Could not find the pullrequest with key '103'
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
...
Caused by: Could not find the pullrequest with key '103'
##[error]Caused by: org.sonarqube.ws.client.HttpException: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=***&pullrequestKey=103 : {"errors":[{"msg":"Unable to find the pullrequest with key \u0027103\u0027"}]}
at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:22)
YAML pipeline:
- task: SonarCloudPrepare@1
displayName: SonarCloud prepare
inputs:
SonarCloud: 'SonarCloud-***-***'
organization: '***'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: '***'
cliProjectName: '***'
cliSources: '.'
extraProperties: |
sonar.verbose=true
sonar.terraform.provider.azure.version=1.5.2
sonar.pullrequest.provider=vsts
- task: TerraformInstaller@0
displayName: terraform install
inputs:
...
- task: TerraformCLI@0
displayName: terraform init
inputs:
...
- task: SonarCloudAnalyze@1
displayName: SonarCloud Analyze
inputs:
jdkversion: 'JAVA_HOME_17_X64'
- task: SonarCloudPublish@1
displayName: SonarCloud Publish
inputs:
pollingTimeoutSec: '300'
How can we fix this?