chore: Update SonarQube project configuration for CI workflows
Some checks failed
Integration Tests / performance-tests (push) Has been cancelled
Integration Tests / integration-tests (push) Has been cancelled
Frontend (React) / test (16) (push) Failing after 1m37s
Frontend (React) / test (20) (push) Failing after 1m28s
Docker Build and Push / build-and-push (push) Failing after 37s
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 20s
API Docs (Node.js Express) / test (20) (push) Successful in 1m37s
API Docs (Node.js Express) / test (16) (push) Successful in 1m40s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 24s
API Docs (Node.js Express) / test (18) (push) Successful in 1m39s
Frontend (React) / test (18) (push) Failing after 1m53s
API Gateway (Java Spring Boot) / test (17) (push) Failing after 1m56s
Frontend (React) / build (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 26s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 23s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 1m47s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 26s
Service Adapters (Python FastAPI) / build (push) Has been skipped
API Gateway (Java Spring Boot) / test (21) (push) Failing after 2m1s
API Docs (Node.js Express) / build (push) Successful in 40s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
LabFusion CI/CD Pipeline / api-docs (push) Successful in 1m46s
LabFusion CI/CD Pipeline / frontend (push) Failing after 1m57s
Frontend (React) / lighthouse (push) Has been skipped
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
Some checks failed
Integration Tests / performance-tests (push) Has been cancelled
Integration Tests / integration-tests (push) Has been cancelled
Frontend (React) / test (16) (push) Failing after 1m37s
Frontend (React) / test (20) (push) Failing after 1m28s
Docker Build and Push / build-and-push (push) Failing after 37s
Service Adapters (Python FastAPI) / test (3.1) (push) Failing after 20s
API Docs (Node.js Express) / test (20) (push) Successful in 1m37s
API Docs (Node.js Express) / test (16) (push) Successful in 1m40s
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 24s
API Docs (Node.js Express) / test (18) (push) Successful in 1m39s
Frontend (React) / test (18) (push) Failing after 1m53s
API Gateway (Java Spring Boot) / test (17) (push) Failing after 1m56s
Frontend (React) / build (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 26s
LabFusion CI/CD Pipeline / service-adapters (push) Failing after 23s
LabFusion CI/CD Pipeline / api-gateway (push) Failing after 1m47s
Service Adapters (Python FastAPI) / test (3.9) (push) Failing after 26s
Service Adapters (Python FastAPI) / build (push) Has been skipped
API Gateway (Java Spring Boot) / test (21) (push) Failing after 2m1s
API Docs (Node.js Express) / build (push) Successful in 40s
API Gateway (Java Spring Boot) / build (push) Has been skipped
API Gateway (Java Spring Boot) / security (push) Has been skipped
LabFusion CI/CD Pipeline / api-docs (push) Successful in 1m46s
LabFusion CI/CD Pipeline / frontend (push) Failing after 1m57s
Frontend (React) / lighthouse (push) Has been skipped
LabFusion CI/CD Pipeline / integration-tests (push) Has been skipped
### Summary of Changes - Changed SonarQube project keys and names for all services to follow a consistent naming convention. - Replaced `sonar-scanner` with `@sonar/scan` in the frontend and other workflows for improved compatibility. - Simplified SonarQube analysis commands by removing unnecessary parameters and ensuring each service reports to its dedicated project. ### Expected Results - Enhanced clarity and maintainability of CI configurations. - Improved isolation of quality metrics for each service in SonarQube. - Streamlined integration process for better reporting and analysis.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# SonarQube Integration for LabFusion
|
||||
|
||||
This document explains how to configure SonarQube integration for all LabFusion services in a unified project.
|
||||
This document explains how to configure SonarQube integration for all LabFusion services using individual projects per service.
|
||||
|
||||
## Overview
|
||||
|
||||
All LabFusion services (API Gateway, Service Adapters, API Docs, Frontend) now send test results, code coverage, and quality metrics directly to a single unified SonarQube project called "LabFusion" instead of using external test reporters.
|
||||
Each LabFusion service has its own dedicated SonarQube project, providing better isolation, clearer metrics per service, and easier maintenance. This approach allows for service-specific quality gates and more granular reporting.
|
||||
|
||||
## Required Configuration
|
||||
|
||||
@@ -17,10 +17,12 @@ You need to configure the following secrets in your Gitea repository:
|
||||
|
||||
### 2. SonarQube Project Setup
|
||||
|
||||
1. **Create a unified project** in SonarQube:
|
||||
- Project Key: `labfusion`
|
||||
- Project Name: `LabFusion`
|
||||
- Main Branch: `main`
|
||||
1. **Create individual projects** in SonarQube for each service:
|
||||
- **API Gateway**: `labfusion-api-gateway` - "LabFusion API Gateway"
|
||||
- **Service Adapters**: `labfusion-service-adapters` - "LabFusion Service Adapters"
|
||||
- **API Docs**: `labfusion-api-docs` - "LabFusion API Docs"
|
||||
- **Frontend**: `labfusion-frontend` - "LabFusion Frontend"
|
||||
- Main Branch: `main` for all projects
|
||||
|
||||
2. **Generate an authentication token**:
|
||||
- Go to User > My Account > Security
|
||||
@@ -37,46 +39,57 @@ Configure quality gates in SonarQube to enforce:
|
||||
|
||||
## What Gets Sent to SonarQube
|
||||
|
||||
### Unified LabFusion Project Structure
|
||||
- **Project Key**: `labfusion`
|
||||
- **Project Name**: `LabFusion`
|
||||
- **Modules**:
|
||||
- `api-gateway` (Java Spring Boot)
|
||||
- `service-adapters` (Python FastAPI)
|
||||
- `api-docs` (Node.js Express)
|
||||
- `frontend` (React)
|
||||
### Individual Service Projects
|
||||
|
||||
### Test Results
|
||||
- **API Gateway**: JUnit XML reports from `target/surefire-reports/`
|
||||
- **Service Adapters**: pytest XML reports from `tests/reports/junit.xml`
|
||||
- **API Docs**: Jest XML reports from `test-results.xml`
|
||||
- **Frontend**: Jest XML reports from `test-results.xml`
|
||||
#### API Gateway
|
||||
- **Project Key**: `labfusion-api-gateway`
|
||||
- **Project Name**: LabFusion API Gateway
|
||||
- **Language**: Java Spring Boot
|
||||
- **Test Reports**: JUnit XML from `target/surefire-reports/`
|
||||
- **Coverage**: JaCoCo XML from `target/site/jacoco/jacoco.xml`
|
||||
|
||||
### Code Coverage
|
||||
- **API Gateway**: JaCoCo XML report from `target/site/jacoco/jacoco.xml`
|
||||
- **Service Adapters**: Coverage XML from `coverage.xml`
|
||||
- **API Docs**: LCOV report from `coverage/lcov.info`
|
||||
- **Frontend**: LCOV report from `coverage/lcov.info`
|
||||
#### Service Adapters
|
||||
- **Project Key**: `labfusion-service-adapters`
|
||||
- **Project Name**: LabFusion Service Adapters
|
||||
- **Language**: Python FastAPI
|
||||
- **Test Reports**: pytest XML from `tests/reports/junit.xml`
|
||||
- **Coverage**: Coverage XML from `coverage.xml`
|
||||
|
||||
#### API Docs
|
||||
- **Project Key**: `labfusion-api-docs`
|
||||
- **Project Name**: LabFusion API Docs
|
||||
- **Language**: Node.js Express
|
||||
- **Test Reports**: Jest XML from `test-results.xml`
|
||||
- **Coverage**: LCOV from `coverage/lcov.info`
|
||||
|
||||
#### Frontend
|
||||
- **Project Key**: `labfusion-frontend`
|
||||
- **Project Name**: LabFusion Frontend
|
||||
- **Language**: React
|
||||
- **Test Reports**: Jest XML from `test-results.xml`
|
||||
- **Coverage**: LCOV from `coverage/lcov.info`
|
||||
|
||||
### Code Quality Metrics
|
||||
- **Source code analysis** results for all languages
|
||||
- **Code smells** and issues across all services
|
||||
- **Security vulnerabilities** detection
|
||||
- **Maintainability ratings** per module
|
||||
- **Source code analysis** results per service
|
||||
- **Code smells** and issues per service
|
||||
- **Security vulnerabilities** detection per service
|
||||
- **Maintainability ratings** per service
|
||||
- **Service-specific quality gates** and thresholds
|
||||
|
||||
## Pipeline Integration
|
||||
|
||||
### All Services Send to Unified Project
|
||||
Each service workflow includes a SonarQube integration step:
|
||||
### Individual Service Projects
|
||||
Each service workflow sends results to its own dedicated SonarQube project:
|
||||
|
||||
#### API Gateway (Java)
|
||||
```yaml
|
||||
- name: Send test results to SonarQube
|
||||
run: |
|
||||
./mvnw sonar:sonar \
|
||||
-Dsonar.projectKey=labfusion \
|
||||
-Dsonar.modules=api-gateway \
|
||||
# ... other properties
|
||||
./mvnw clean verify sonar:sonar \
|
||||
-Dsonar.projectKey=labfusion-api-gateway \
|
||||
-Dsonar.projectName=LabFusion API Gateway \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
|
||||
```
|
||||
|
||||
#### Service Adapters (Python)
|
||||
@@ -84,19 +97,32 @@ Each service workflow includes a SonarQube integration step:
|
||||
- name: Send results to SonarQube
|
||||
run: |
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=labfusion \
|
||||
-Dsonar.modules=service-adapters \
|
||||
# ... other properties
|
||||
-Dsonar.projectKey=labfusion-service-adapters \
|
||||
-Dsonar.projectName=LabFusion Service Adapters \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
|
||||
```
|
||||
|
||||
#### API Docs & Frontend (Node.js)
|
||||
#### API Docs (Node.js)
|
||||
```yaml
|
||||
- name: Send results to SonarQube
|
||||
run: |
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=labfusion \
|
||||
-Dsonar.modules=api-docs \
|
||||
# ... other properties
|
||||
-Dsonar.projectKey=labfusion-api-docs \
|
||||
-Dsonar.projectName=LabFusion API Docs \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
|
||||
```
|
||||
|
||||
#### Frontend (React)
|
||||
```yaml
|
||||
- name: Send results to SonarQube
|
||||
run: |
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=labfusion-frontend \
|
||||
-Dsonar.projectName=LabFusion Frontend \
|
||||
-Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \
|
||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
|
||||
```
|
||||
|
||||
## Maven Plugins Added
|
||||
@@ -164,27 +190,35 @@ sonar.testExecutionReportPaths=test-results.xml
|
||||
|
||||
## Benefits
|
||||
|
||||
### 1. Centralized Quality Management
|
||||
- All quality metrics in one place
|
||||
- Historical trend analysis
|
||||
- Cross-project comparisons
|
||||
### 1. Service Isolation
|
||||
- Each service has its own quality metrics
|
||||
- Service-specific quality gates and thresholds
|
||||
- Independent quality tracking per service
|
||||
- Clear ownership and responsibility
|
||||
|
||||
### 2. Automated Quality Gates
|
||||
- Pipeline fails if quality standards not met
|
||||
- Enforces consistent code quality
|
||||
- Prevents regression in code quality
|
||||
### 2. Granular Reporting
|
||||
- Service-specific test coverage reports
|
||||
- Individual code smell identification
|
||||
- Per-service security vulnerability detection
|
||||
- Service-level technical debt tracking
|
||||
|
||||
### 3. Detailed Reporting
|
||||
- Comprehensive test coverage reports
|
||||
- Code smell identification
|
||||
- Security vulnerability detection
|
||||
- Technical debt tracking
|
||||
### 3. Flexible Quality Gates
|
||||
- Different quality standards per service type
|
||||
- Language-specific quality rules
|
||||
- Service-specific maintenance windows
|
||||
- Independent quality gate configurations
|
||||
|
||||
### 4. Integration Benefits
|
||||
### 4. Better Organization
|
||||
- Clear separation of concerns
|
||||
- Easier to identify problematic services
|
||||
- Service-specific team assignments
|
||||
- Independent service evolution
|
||||
|
||||
### 5. Integration Benefits
|
||||
- No external service dependencies
|
||||
- Local data control
|
||||
- Customizable quality rules
|
||||
- Team collaboration features
|
||||
- Customizable quality rules per service
|
||||
- Team collaboration features per service
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
||||
Reference in New Issue
Block a user