Retry yml
This commit is contained in:
46
.drone.yml
46
.drone.yml
@@ -12,14 +12,19 @@ steps:
|
|||||||
- name: build-and-publish-backend
|
- name: build-and-publish-backend
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
|
# El registro es la IP pública para que Docker pueda subir la imagen
|
||||||
registry:
|
registry:
|
||||||
from_secret: REGISTRY_URL
|
from_secret: REGISTRY_URL
|
||||||
|
# El repo se construye con el dueño y nombre del repo en Gitea
|
||||||
|
repo: ${{DRONE_REPO_OWNER}}/${{DRONE_REPO_NAME}}-backend
|
||||||
|
# El usuario y la contraseña (PAT) para el login
|
||||||
username:
|
username:
|
||||||
from_secret: GITEA_USER
|
from_secret: GITEA_USER
|
||||||
password:
|
password:
|
||||||
from_secret: ACTIONS_PAT
|
from_secret: ACTIONS_PAT
|
||||||
repo: ${{DRONE_REPO_OWNER}}/${{DRONE_REPO_NAME}}-backend
|
# El Dockerfile a usar
|
||||||
dockerfile: Backend/GestionIntegral.Api/Dockerfile
|
dockerfile: Backend/GestionIntegral.Api/Dockerfile
|
||||||
|
# Las etiquetas
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- ${{DRONE_COMMIT_SHA:0:8}}
|
- ${{DRONE_COMMIT_SHA:0:8}}
|
||||||
@@ -29,11 +34,11 @@ steps:
|
|||||||
settings:
|
settings:
|
||||||
registry:
|
registry:
|
||||||
from_secret: REGISTRY_URL
|
from_secret: REGISTRY_URL
|
||||||
|
repo: ${{DRONE_REPO_OWNER}}/${{DRONE_REPO_NAME}}-frontend
|
||||||
username:
|
username:
|
||||||
from_secret: GITEA_USER
|
from_secret: GITEA_USER
|
||||||
password:
|
password:
|
||||||
from_secret: ACTIONS_PAT
|
from_secret: ACTIONS_PAT
|
||||||
repo: ${{DRONE_REPO_OWNER}}/${{DRONE_REPO_NAME}}-frontend
|
|
||||||
dockerfile: Frontend/Dockerfile
|
dockerfile: Frontend/Dockerfile
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
@@ -41,6 +46,7 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- build-and-publish-backend
|
- build-and-publish-backend
|
||||||
|
|
||||||
|
# --- ¡LA SECCIÓN FINAL Y CORRECTA! ---
|
||||||
- name: deploy-to-production
|
- name: deploy-to-production
|
||||||
image: appleboy/drone-ssh
|
image: appleboy/drone-ssh
|
||||||
settings:
|
settings:
|
||||||
@@ -50,27 +56,25 @@ steps:
|
|||||||
from_secret: PROD_SERVER_USER
|
from_secret: PROD_SERVER_USER
|
||||||
key:
|
key:
|
||||||
from_secret: PROD_SERVER_SSH_KEY
|
from_secret: PROD_SERVER_SSH_KEY
|
||||||
environment:
|
|
||||||
SA_PASSWORD:
|
# --- ¡LA SINTAXIS CORRECTA! ---
|
||||||
from_secret: DB_SA_PASSWORD_SECRET
|
# Le pasamos los secretos como variables de entorno al script
|
||||||
JWT_KEY:
|
env_vars:
|
||||||
from_secret: JWT_KEY_SECRET
|
- DB_SA_PASSWORD=${DB_SA_PASSWORD_SECRET}
|
||||||
REGISTRY:
|
- JWT_KEY=${JWT_KEY_SECRET}
|
||||||
from_secret: REGISTRY_URL
|
- REGISTRY_URL=${REGISTRY_URL}
|
||||||
GITEA_USER:
|
- GITEA_USER=${GITEA_USER}
|
||||||
from_secret: GITEA_USER
|
- ACTIONS_PAT=${ACTIONS_PAT}
|
||||||
GITEA_PAT:
|
|
||||||
from_secret: ACTIONS_PAT
|
# El plugin usa 'script', no 'commands'.
|
||||||
commands:
|
script:
|
||||||
# Todos los comandos de la lista deben tener esta indentación
|
|
||||||
- cd /opt/gestion-integral
|
- cd /opt/gestion-integral
|
||||||
- export DB_SA_PASSWORD=$${SA_PASSWORD}
|
- export DB_SA_PASSWORD # Las variables ya están en el entorno, solo las exportamos
|
||||||
- export JWT_KEY=$${JWT_KEY}
|
- export JWT_KEY
|
||||||
- docker login $${REGISTRY} -u $${GITEA_USER} -p $${GITEA_PAT}
|
- docker login $REGISTRY_URL -u $GITEA_USER -p $ACTIONS_PAT
|
||||||
- docker compose pull
|
- docker compose pull
|
||||||
- docker compose up -d
|
- docker compose up -d
|
||||||
- docker image prune -af
|
- docker image prune -af
|
||||||
|
|
||||||
# depends_on está fuera de 'settings', al mismo nivel que 'name', 'image', etc.
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- build-and-publish-frontend
|
- build-and-publish-frontend
|
||||||
Reference in New Issue
Block a user