40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: spring-boot-java21
|
|
|
|
workspace:
|
|
base: /drone/src
|
|
|
|
steps:
|
|
# Paso 1: Build y tests con Maven (Java 21)
|
|
- name: build-and-test
|
|
image: maven:3.9-eclipse-temurin-21-alpine
|
|
environment:
|
|
MAVEN_OPTS: -Xmx2048m -XX:+TieredCompilation -XX:TieredStopAtLevel=1
|
|
commands:
|
|
- mvn clean verify
|
|
- mvn jacoco:report # Generar reporte de cobertura
|
|
volumes:
|
|
- name: maven-cache
|
|
path: /root/.m2
|
|
|
|
# Paso 2: Análisis SonarQube con Maven
|
|
- name: sonarqube-analysis
|
|
image: maven:3.9-eclipse-temurin-21-alpine
|
|
environment:
|
|
#SONAR_HOST_URL: ${SONARQUBE_URL} # URL de tu servidor SonarQube
|
|
#SONAR_LOGIN: ${SONARQUBE_TOKEN} # Token de autenticación en SonarQube
|
|
#SONAR_PROJECT_KEY: ${SONARQUBE_PROJECT_KEY} # Clave del proyecto en SonarQube
|
|
SONAR_HOST_URL: http://10.0.0.126:9000 # URL de tu servidor SonarQube
|
|
SONAR_LOGIN: squ_465ae384ffda803d8e58d9ef0111bef1277c874a # Token de autenticación en SonarQube
|
|
SONAR_PROJECT_KEY: hhh # Clave del proyecto en SonarQube
|
|
commands:
|
|
- mvn sonar:sonar # Ejecuta el análisis de SonarQube usando Maven
|
|
- mvn clean verify sonar:sonar -DskipTests
|
|
when:
|
|
event: [push, pull_request]
|
|
|
|
volumes:
|
|
- name: maven-cache
|
|
temp: {}
|