We have Spring Boot application with multiple modules and one Angular project in the same repository.
Project structure is like this:
app-1
app-1-dto
app-2
app-2-dto
app-2-feign
app-2-stream
app-web
app-web-angular
Each project has pom.xml and capable of producing artifacts, root pom.xml handles build process for the whole repository and in the bitbucket pipeline for the backend is configured like this:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- maven
- sonar
script:
- mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -pl !app-web-angular -Dbitbucket=true
artifacts:
- target/**
So this works for java side of the code. I tried to configure another step for Typescript (Angular) like this:
- step: &build-test-front-end
name: npm app-web-angular
image: feeni/node-chrome:latest
caches:
- node
- sonar
script:
- cd app-web-angular
- npm install --quiet
- npm update caniuse-lite browserslist
- npm run test -- --code-coverage --no-watch --no-progress --browsers=ChromeHeadlessNoSandbox
- pipe: sonarsource/sonarcloud-scan:0.1.5
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
EXTRA_ARGS: '-Dsonar.projectBaseDir=../ -Dsonar.sources=app-web-angular/src -Dsonar.tests=app-web-angular/src -Dsonar.exclusions=**/node_modules/**,**/*.spec.ts,**/e2e/**,**/coverage/** -Dsonar.test.inclusions="**/testing/**,**/*.spec.ts" -Dsonar.typescript.tsconfigPath=app-web-angular/tslint.json -Dsonar.typescript.lcov.reportPaths=app-web-angular/coverage/lcov.info'
So step is successful too when running individually but it doesn’t produce any activity in the sonarcloud for the branch.
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=28ms
INFO: 181 files had no CPD blocks
INFO: Calculating CPD for 825 files
INFO: CPD calculation finished
INFO: SCM writing changed lines
INFO: SCM writing changed lines (done) | time=5ms
INFO: Analysis report generated in 160ms, dir size=1 MB
INFO: Analysis report compressed in 1223ms, zip size=1 MB
INFO: Analysis report uploaded in 680ms
INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarcloud.io/dashboard?id=XXXXXXXXXXXXX&branch=feature%2Fsonarcloud-for-front-end-support&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=XXXXXXXX
INFO: Analysis total time: 50.367 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:12.965s
INFO: Final Memory: 29M/114M
INFO: ------------------------------------------------------------------------
✔ SonarCloud analysis was successful.
What am I missing?
Thank you,
Sergey