Reputation: 23565
I was wondering how to aggregate the SonarQube Maven analysis for multiple jobs in GitLab CI pipelines.
My GitLab CI pipeline builds backend and frontend components in separate jobs (in the same stage). They require different build environments and, hence, they use different images. Skeleton:
build-backend:
image: my-backend-image
stage: build
script:
- mvn xyz verify
build-frontend:
image: my-frontend-image
stage: build
script:
- build-frontend
If I add Sonar scanning to both jobs they would overwrite each others results on SonarQube. Hence, AFAIU I need either
mvn sonar:sonar
.Is there are simpler solution I missed?
Upvotes: 3
Views: 908
Reputation: 23565
Turning my earlier comment into an answer in order to "resolve" this Q.
We have been using option 3 at work and are very pleased with the results. I see three main advantages of this approach:
Upvotes: 1