Skip to content

feat: full Jenkins CI/CD pipeline with SonarQube analysis - #7

Merged
cabrasky merged 1 commit into
mainfrom
feature/jenkins-sonar-ci
Jul 1, 2026
Merged

cabrasky merged 1 commit into
mainfrom
feature/jenkins-sonar-ci

Conversation

@cabrasky

@cabrasky cabrasky commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Descripcion

Pipeline CI/CD completa para Table2Taste con analisis de calidad SonarQube.

Pipeline stages (7)

Stage Descripcion
Checkout Clona el repo
Read Version Versión desde package.json + git SHA → IMAGE_TAG
Check Image Exists Salta build si la imagen ya esta en registry
Test Backend mvn test jacoco:report + publica JUnit
Test Frontend npm ci + npm test -- --ci + react-scripts build
SonarQube Analysis mvn sonar:sonar con cobertura JaCoCo
Docker Build & Push Build + push de imagenes backend y frontend en paralelo

Archivos

Archivo Descripcion
Jenkinsfile Pipeline completo
sonar-project.properties Configuracion de SonarQube
packages/backend/pom.xml JaCoCo + sonar-maven-plugin

Infraestructura

- Create Jenkinsfile with 7 stages: Checkout, Read Version, Check Image
  Exists, Test Backend (mvn test + JaCoCo), Test Frontend (npm ci + build),
  SonarQube Analysis, Docker Build & Push
- Add sonar-project.properties for project analysis config
- Add JaCoCo and Sonar Maven plugins to pom.xml
- Add .gitignore entry for coverage and target dirs
Copilot AI review requested due to automatic review settings July 1, 2026 09:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Jenkins-based CI/CD pipeline for the Table2Taste monorepo, aiming to run backend/frontend tests, perform SonarQube quality analysis, and build/push Docker images to the internal registry.

Changes:

  • Introduces a new Jenkinsfile declarative pipeline with stages for checkout, versioning, tests, SonarQube analysis, and Docker build/push.
  • Adds SonarQube scanner configuration via sonar-project.properties.
  • Updates the backend Maven build to include JaCoCo coverage and the Sonar Maven plugin.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
Jenkinsfile New Jenkins Declarative Pipeline covering tests, SonarQube, and Docker build/push.
sonar-project.properties SonarQube project configuration intended to cover backend + frontend.
packages/backend/pom.xml Adds JaCoCo and Sonar Maven plugin to support coverage + analysis.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Jenkinsfile
Comment on lines +1 to +11
# ── Table2Taste CI/CD Pipeline ─────────────────────────
# Builds, tests, runs SonarQube analysis, and pushes Docker images
#
# Jenkins instance: jenkins.cabrasky.net (node1)
# SonarQube: sonar.cabrasky.net
# Registry: 192.168.1.11:5000
#
# ⚠️ Jenkins does NOT have pipeline-utility-steps plugin
# → Use python3 instead of readJSON
# ⚠️ 'when { not { ... } }' does NOT work
# → Use 'when { expression { return !... } }'
Comment thread Jenkinsfile
Comment on lines +110 to +112
sh 'npm ci'
sh 'npm test -- --watchAll=false --ci --coverage 2>&1 || true'
sh 'npx react-scripts build 2>&1'
Comment thread Jenkinsfile
Comment on lines +129 to +141
dir('packages/backend') {
sh """
./mvnw sonar:sonar \
-Dsonar.host.url=${SONAR_HOST_URL} \
-Dsonar.token=${SONAR_TOKEN} \
-Dsonar.projectKey=table2taste \
-Dsonar.projectName='Table2Taste' \
-Dsonar.sources=src/main/java \
-Dsonar.tests=src/test/java \
-Dsonar.java.binaries=target/classes \
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \
-Dsonar.exclusions=**/model/dto/**
"""
Comment thread Jenkinsfile
Comment on lines +155 to +159
sh "docker build -t ${BACKEND_IMAGE}:${IMAGE_TAG} ."
sh "docker tag ${BACKEND_IMAGE}:${IMAGE_TAG} ${BACKEND_IMAGE}:latest"
sh "docker push ${BACKEND_IMAGE}:${IMAGE_TAG}"
sh "docker push ${BACKEND_IMAGE}:latest"
}
Comment thread Jenkinsfile
Comment on lines +165 to +169
sh "docker build -t ${FRONTEND_IMAGE}:${IMAGE_TAG} ."
sh "docker tag ${FRONTEND_IMAGE}:${IMAGE_TAG} ${FRONTEND_IMAGE}:latest"
sh "docker push ${FRONTEND_IMAGE}:${IMAGE_TAG}"
sh "docker push ${FRONTEND_IMAGE}:latest"
}
Comment thread Jenkinsfile
Comment on lines +178 to +180
always {
sh 'docker image prune -f || true'
}
Comment thread Jenkinsfile
Comment on lines +116 to +119
always {
junit allowEmptyResults: true,
testResults: 'packages/frontend/junit.xml'
}
Comment thread sonar-project.properties
Comment on lines +10 to +12
# Language
sonar.language=java,ts

@cabrasky
cabrasky merged commit 28d3613 into main Jul 1, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants