Skip to content

Instantly share code, notes, and snippets.

@harshanas
Created August 12, 2020 17:18
Show Gist options
  • Save harshanas/8b7b38ca63bb7799b8c11452910ea00b to your computer and use it in GitHub Desktop.
Save harshanas/8b7b38ca63bb7799b8c11452910ea00b to your computer and use it in GitHub Desktop.
Integrate SonarCloud with AWS CodeCommit and CodeBuild
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- apt-get update
- apt-get install -y jq
- wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-linux.zip
- unzip ./sonar-scanner-cli-3.3.0.1492-linux.zip
- export PATH=$PATH:./sonar-scanner-3.3.0.1492-linux/bin/
pre_build:
commands:
- sonar-scanner -Dsonar.organization=$SONARCLOUD_ORG -Dsonar.projectKey=$PROJECTKEY -Dsonar.sources=src -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONARCLOUD_TOKEN
- sleep 5
- curl https://sonarcloud.io/api/qualitygates/project_status?projectKey=$PROJECTKEY > analysis.json
- cat analysis.json
build:
commands:
- echo Building Project
- echo Finished Building
cache:
paths:
- "node_modules/**/*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment