I am trying to run Sonar Cloud in an Azure DevOps pipeline, for a Node.JS pipeline. I am using the following YAML code to create the pipeline:
- task: SonarCloudPrepare@1 displayName: 'Prepare SonarCloud analysis' inputs: SonarCloud: 'ServiceConnectionName' organization: $(SonarOrganization) scannerMode: 'CLI' cliProjectKey: $(SonarProjectKey) cliProjectName: $(SonarProjectName) cliSources: 'ProjectFolder' - bash: cd ProjectFolder && npm ci displayName: "Calling npm ci" - bash: cd ProjectFolder && npm run build displayName: "Calling npm run build" - task: SonarCloudAnalyze@1 displayName: 'Run SonarCloud code analysis' - task: SonarCloudPublish@1 displayName: 'Publish SonarCloud quality gate results'
I have already tried to hardcode the organization, project key and project name. It still doesn’t work! I am getting the following error:
ERROR: You must define the following mandatory properties for ‘Unknown’: sonar.projectKey
Where exactly do I fetch the project key? I am assuming that is the error. I can’t find this key