- ALM used - Azure DevOps
- CI system used - Azure DevOps
- Scanner command used when applicable:
# SonarCloud Scans for repo sensors-js
name: SonarCloud_Scans_repo_sensors-js
variables:
- group: gradle.properties
trigger:
paths:
include:
- tagging
- build.gradle
# =================================================================================
# Execution Plan
# =================================================================================
# ---------------------------------------------------------------------------------
# Job
# ---------------------------------------------------------------------------------
pool:
vmImage: "macOS-latest"
steps:
- checkout: self
clean: true
fetchDepth: 1
- task: DownloadSecureFile@1
displayName: "Download Build Script"
inputs:
secureFile: "hidden"
- task: ExtractFiles@1
displayName: "Extract Build Script"
inputs:
archiveFilePatterns: "$(Agent.TempDirectory)/hidden"
destinationFolder: "$(Agent.TempDirectory)/hidden"
- script: |
cd unit-tests
sudo npm install
sudo npm install --global gulp-cli
displayName: "Install npm dependencies"
- task: Gradle@2
displayName: "Publish Demo"
inputs:
workingDirectory: "tagging"
gradleWrapperFile: "tagging/gradlew"
options: "-Pcustomer=demo -Pusername=$(username) -Pkasrl=$(kasrl) -PkasrlLoc=$(kasrlLoc) -PvstsGradleAccessToken=$(vstsGradleAccessToken) -PazureFileShareName=$(azureFileShareName) -PazureStorageConnectionString=$(azureStorageConnectionString)"
tasks: ":sensors-js.tagging:publishAndClean :sensors-js.tagging:uploadToAzureFiles"
publishJUnitResults: true
testResultsFiles: "**/TEST-*.xml"
javaHomeOption: "JDKVersion"
gradleOptions: "-Xmx3072m"
- task: SonarCloudPrepare@4
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: 'SonarCloud_connection'
organization: 'hidden'
scannerMode: CLI
configMode: manual
cliProjectKey: 'hidden'
cliProjectName: 'hidden'
- task: SonarCloudAnalyze@4
displayName: 'Run Code Analysis'
- task: SonarCloudPublish@4
displayName: 'Publish Quality Gate Result'
And i also try to run scans without building it first:
# SonarCloud Scans for repo sensors-js
name: SonarCloud_Scans_repo_sensors-js
pool:
vmImage: 'ubuntu-22.04'
demands: java
steps:
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarCloud: 'SonarCloud_connection'
organization: 'hidden'
scannerMode: CLI
configMode: manual
cliProjectKey: 'hidden'
cliProjectName: 'hidden'
- task: SonarCloudAnalyze@1
displayName: 'Run Code Analysis'
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
- Languages of the repository - JavaScript
- Error observed:
==============================================================================
Task : Publish Quality Gate Result
Description : Publish SonarCloud's Quality Gate result on the Azure Pipelines build result. To be used after the actual analysis.
Version : 1.15.2
Author : sonarsource
Help : Version: 1.15.2. [More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)
==============================================================================
##[error][SQ] Error retrieving analysis: [SQ] API GET '/api/qualitygates/project_status' failed, status code was: 404
##[error][SQ] Could not fetch analysis for ID 'AY0xrdPPElEmuaclDAoS'
Finishing: Publish Quality Gate Result
In the same project when i’m scanning other repositories with code in python for example, everything is working correctly.
Task Run Code Analysis
INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=hidden&branch=feature-damianb&resolved=false
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AY0xhBFY-4oriwyXn2Hz
INFO: Sensor cache published successfully
INFO: Analysis total time: 1:26.977 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:30.708s
INFO: Final Memory: 37M/130M
INFO: ------------------------------------------------------------------------
Finishing: Run Code Analysis
Output from link:
{
"task": {
"id": "AY0xrdGQwF60JsIV0Exr",
"type": "REPORT",
"componentId": "AYwbyW-fk0IXurqtdWhA",
"componentKey": "hidden",
"componentName": "hidden",
"componentQualifier": "TRK",
"analysisId": "AY0xrdPPElEmuaclDAoS",
"status": "SUCCESS",
"submittedAt": "2024-01-22T15:58:11+0100",
"submitterLogin": "hidden",
"startedAt": "2024-01-22T15:58:11+0100",
"executedAt": "2024-01-22T15:58:13+0100",
"executionTimeMs": 1731,
"logs": false,
"hasScannerContext": true,
"organization": "hidden",
"branch": "feature-damianb",
"branchType": "SHORT",
"warningCount": 3,
"warnings": []
}
}