Skip to content

Commit

Permalink
Add sonarcloud tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1211 committed Feb 20, 2024
1 parent 8f0e4d9 commit f465371
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ stages:
- script: npm ci
displayName: 'Install'

- task: SonarQubePrepare@5
displayName: 'Prepare analysis on SonarQube'
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis on SonarCloud'
inputs:
SonarQube: 'sonarqube-connection'
SonarCloud: 'SonarCloud'
organization: 'nhsdigital'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectName: 'User Feedback Store'
cliProjectKey: 'nhsuk-user-feedback-store'
projectKey: 'nhsuk-user-feedback-store'
projectName: 'User Feedback Store'
extraProperties: |
sonar.exclusions=$(System.DefaultWorkingDirectory)/dependency-scan-results/**
sonar.javascript.lcov.reportPaths=coverage/lcov.info
Expand All @@ -45,14 +45,20 @@ stages:
- script: npm run test
displayName: 'Test'

- task: SonarQubeAnalyze@5
displayName: 'Run code analysis'
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud Code Analysis'

- task: SonarQubePublish@5
displayName: 'Publish quality gate result'
- task: SonarCloudPublish@1
displayName: 'Publish Quality Gate Result'
inputs:
pollingTimeoutSec: '300'

- task: sonarcloud-buildbreaker@2
displayName: "Break the build if the quality gate fails"
inputs:
SonarCloud: 'SonarCloud'
organization: 'nhsdigital'

- stage: DevDeployment
displayName: 'Dev Deployment'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/main'))
Expand Down

0 comments on commit f465371

Please sign in to comment.