From f46537187fe2a67f012949cebfdd002512218731 Mon Sep 17 00:00:00 2001 From: Mayank Patel Date: Tue, 20 Feb 2024 17:02:13 +0000 Subject: [PATCH] Add sonarcloud tasks --- azure-pipelines.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cc41a6b..fb89ca6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 @@ -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'))