This commit is contained in:
parent
4cbd3fdc7c
commit
3f0523752e
58
.drone.yml
58
.drone.yml
@ -6,33 +6,33 @@ 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 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]
|
||||
# # 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]
|
||||
|
||||
# Paso 3: Build y Push de Docker Image a Nexus (NUEVO)
|
||||
- name: docker-build-push
|
||||
@ -69,7 +69,7 @@ steps:
|
||||
username: ${SSH_USER}
|
||||
password: ${SSH_PASSWORD} # ⚠️ Recomendado usar secretos en Drone
|
||||
script:
|
||||
- docker login -u yandel -p yandel $REGISTRY_ADDRESS
|
||||
- docker login -u $NEXUS_USER -p $NEXUS_PASSWORD $REGISTRY_ADDRESS
|
||||
- docker pull $REGISTRY_ADDRESS/$REPOSITORY_NAME/${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA}
|
||||
- docker stop mi-app || true
|
||||
- docker rm mi-app || true
|
||||
@ -77,8 +77,8 @@ steps:
|
||||
|
||||
|
||||
volumes:
|
||||
- name: maven-cache
|
||||
temp: {}
|
||||
# - name: maven-cache
|
||||
# temp: {}
|
||||
- name: docker-sock
|
||||
host:
|
||||
path: /var/run/docker.sock # Montar socket de Docker
|
||||
|
Loading…
x
Reference in New Issue
Block a user