Skip to content

Commit

Permalink
feat: add sonarqube bitbucket (#43)
Browse files Browse the repository at this point in the history
* feat: add sonarqube bitbucket

* chore: change sonar projectKey
  • Loading branch information
pawelTshDev authored Mar 28, 2024
1 parent f96d63c commit 83d2a2c
Show file tree
Hide file tree
Showing 6 changed files with 927 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ node_modules
.step-functions-local
.bak
.idea
.nyc_output
/coverage
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ We support ASL for Step Functions. Make sure to install AWS Toolkit so you can r

##

### SonarQube configuration

Before deployment make sure to create a new SonarQube project. After that set proper repository variables (`SONAR_TOKEN` and `SONAR_HOST_URL`) and properties in `sonar-project.properties` file.

##

### Deploy

The best choice for deployment is the bitbucket pipeline.
Expand Down
14 changes: 13 additions & 1 deletion bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
image: node:20-alpine
definitions:
caches:
sonar: /opt/sonar-scanner/.sonar
steps:
- step: &compile
name: Compile
Expand All @@ -8,7 +10,9 @@ definitions:
script:
- npm ci
- npm run lint
# - npm run test
- npm run test-coverage
artifacts:
- coverage/**
- step: &deploy
name: Deploy
trigger: manual
Expand All @@ -18,10 +22,18 @@ definitions:
- npm install
- ./node_modules/.bin/serverless config credentials --provider aws --key ${AWS_LAMBDA_KEY} --secret ${AWS_LAMBDA_SECRET}
- ./node_modules/.bin/serverless deploy --stage ${STAGE}
- step: &sonarqube-analysis
name: SonarQube analysis
image: sonarsource/sonar-scanner-cli:latest
caches:
- sonar
script:
- sonar-scanner

pipelines:
default:
- step: *compile
- step: *sonarqube-analysis
custom:
deploy-to-dev:
- step: *compile
Expand Down
Loading

0 comments on commit 83d2a2c

Please sign in to comment.