Skip to content

Commit 9575274

Browse files
committed
Update
1 parent 9ec1a4b commit 9575274

File tree

3 files changed

+26
-35
lines changed

3 files changed

+26
-35
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
DOCKERHUB_USER=yunomix2834
33
DOCKERHUB_PASSWORD=dinhanst2832004
44
DOCKERHUB_TOKEN=dckr_pat_jwDE4gMMqQZ7y3-e3dZFmsMDYKM
5-
IMAGE_TAG=0.1.0
5+
IMAGE_TAG=latest
66

77
#Postgresql
88
IDENTITY_USERNAME=postgres_identity

.github/workflows/ci-sonar.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,36 @@ jobs:
3939
**/target/failsafe-reports/**
4040
if-no-files-found: ignore
4141

42-
- name: SonarQube Scan
42+
- name: SonarQube / SonarCloud Scan
4343
env:
4444
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4545
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
46+
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
47+
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
4648
run: |
4749
if [ -z "$SONAR_TOKEN" ] || [ -z "$SONAR_HOST_URL" ]; then
4850
echo "SONAR_* secrets chưa được cấu hình => bỏ qua phân tích Sonar."
4951
exit 0
5052
fi
51-
mvn -B -DskipTests=true \
52-
-Dsonar.coverage.jacoco.xmlReportPaths='**/target/site/**/jacoco*.xml' \
53-
sonar:sonar
53+
54+
# Đường dẫn report JaCoCo aggregate (được tạo ở bước 'verify' của root pom)
55+
JACOCO_XML="target/site/jacoco-aggregate/jacoco.xml"
56+
57+
if echo "$SONAR_HOST_URL" | grep -qi "sonarcloud.io"; then
58+
# SonarCloud cần organization + projectKey
59+
if [ -z "$SONAR_ORGANIZATION" ] || [ -z "$SONAR_PROJECT_KEY" ]; then
60+
echo "Thiếu SONAR_ORGANIZATION hoặc SONAR_PROJECT_KEY cho SonarCloud."
61+
exit 1
62+
fi
63+
mvn -B -DskipTests=true \
64+
-Dsonar.organization="$SONAR_ORGANIZATION" \
65+
-Dsonar.projectKey="$SONAR_PROJECT_KEY" \
66+
-Dsonar.coverage.jacoco.xmlReportPaths="$JACOCO_XML" \
67+
sonar:sonar
68+
else
69+
# SonarQube self-hosted: KHÔNG dùng sonar.organization
70+
mvn -B -DskipTests=true \
71+
-Dsonar.coverage.jacoco.xmlReportPaths="$JACOCO_XML" \
72+
sonar:sonar
73+
fi
74+

docker/organization-service.Dockerfile

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)