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 commands: - mvn sonar:sonar # Ejecuta el análisis de SonarQube usando Maven when: event: [push, pull_request] volumes: - name: maven-cache temp: {}