Very similar to Could not find the pullrequest with key
This used to work fine for us and then stopped a few months ago. We are using the stand alone Sonar Scanner for analysis. The “Run Code Analysis”(v 1.40.0) optional Task fails anytime a new PR is created. The pipeline itself “Generic analysis with SonarCloud-CI” can be ran successfully but not when invoked for a PR.
Do I indeed need to delete the entire project from SonarCloud and recreate it?
name: Azure Pipelines
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
Included the Analysis output, but the issue doesn’t seem to be the analysis itself. I can manually execute the pipeline against a specific branch like “develop” but I can’t execute it against a user specific branch for a PR.
I have the same issue. Our PAT did expire, but I created a new one and updated SonarCloud. However, I still get the same error. It seems like it won’t fetch PR information if the PAT expired once, irrespective of whether you create a new one or not.
Some solutions I’ve seen suggest recreating the SonarCloud projects, but that’s a problem. I have a LOT of projects that will need to be recreated. Also, I don’t want to lose the history that’s been accumulated so far.
As Charl mentionned, your issue is probably related to an expired PAT (personal access token) or with incorrect rights.
We advise to always setup your PAT at organization level (Administration > Organization settings > Azure devops connectivity management) and remove all PAT at project level (that way when it expires, you only update it once at org level).
It appears you are correct.
I had updated a PAT token previously, but I think I had done it at the project level and it had originally been setup at the organization level.
We’ve been messing with this for a few days and I have noticed more than a few threads along a similar vain. Now that I see it and have gone through it, it seems as straight forward as we thought it would be. That said, I think it’s worth asking why the nature of the issue itself isn’t more apparent or where the common disconnect is that is keeping users for recognizing both the issue and its remediation steps.
Constructive feedback from a customer that enjoys your product and the value it delivers to our team!
Keep up the fantastic work!