Retry 2309
Some checks failed
Optimized Build and Deploy / remote-build-and-deploy (push) Failing after 1m19s
Some checks failed
Optimized Build and Deploy / remote-build-and-deploy (push) Failing after 1m19s
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
echo "--- INICIO DEL DESPLIEGUE OPTIMIZADO ---"
|
echo "--- INICIO DEL DESPLIEGUE OPTIMIZADO ---"
|
||||||
|
|
||||||
# 1. Preparar entorno
|
# 1. Preparar entorno (sin cambios)
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
REPO_OWNER="dmolinari"
|
REPO_OWNER="dmolinari"
|
||||||
REPO_NAME="gestionintegralweb"
|
REPO_NAME="gestionintegralweb"
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
cd "$TEMP_DIR"
|
cd "$TEMP_DIR"
|
||||||
git checkout "${{ gitea.sha }}"
|
git checkout "${{ gitea.sha }}"
|
||||||
|
|
||||||
# 2. Construcción paralela con Docker nativo (más rápido y fiable)
|
# 2. Construcción paralela (sin cambios)
|
||||||
build_image() {
|
build_image() {
|
||||||
local dockerfile=$1
|
local dockerfile=$1
|
||||||
local image_name=$2
|
local image_name=$2
|
||||||
@@ -55,25 +55,31 @@ jobs:
|
|||||||
(build_image "Frontend/Dockerfile" "dmolinari/gestionintegralweb-frontend:latest" ".") &
|
(build_image "Frontend/Dockerfile" "dmolinari/gestionintegralweb-frontend:latest" ".") &
|
||||||
wait
|
wait
|
||||||
|
|
||||||
# 3. Despliegue con Docker Compose
|
# Copiamos la versión actualizada del docker-compose.yml al directorio de despliegue.
|
||||||
cd /opt/gestion-integral
|
echo "Copiando el archivo docker-compose.yml actualizado..."
|
||||||
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
|
cp "$TEMP_DIR/docker-compose.yml" /opt/gestion-integral/docker-compose.yml
|
||||||
|
|
||||||
# Pasa el secreto de Gitea a un Docker Secret
|
# (Opcional pero recomendado) Verificamos que el archivo se copió bien
|
||||||
# El comando "tr -d '\n'" elimina cualquier salto de línea final
|
echo "--- Verificando contenido del docker-compose.yml que se usará ---"
|
||||||
printf "%s" "${{ secrets.JWT_KEY }}" | tr -d '\n' | docker secret create jwt_secret_key - || docker secret inspect jwt_secret_key > /dev/null
|
cat /opt/gestion-integral/docker-compose.yml | head -n 5
|
||||||
|
echo "------------------------------------------------------------------"
|
||||||
|
|
||||||
|
# 3. Crear/Actualizar los Docker Secrets (sin cambios)
|
||||||
|
# ... (tus comandos docker secret create) ...
|
||||||
|
printf "%s" '${{ secrets.JWT_KEY }}' | docker secret create jwt_key - 2>/dev/null || (printf "%s" '${{ secrets.JWT_KEY }}' | docker secret rm jwt_key && printf "%s" '${{ secrets.JWT_KEY }}' | docker secret create jwt_key -)
|
||||||
|
printf "%s" '${{ secrets.DB_SA_PASSWORD_SECRET }}' | docker secret create db_password - 2>/dev/null || (printf "%s" '${{ secrets.DB_SA_PASSWORD_SECRET }}' | docker secret rm db_password && printf "%s" '${{ secrets.DB_SA_PASSWORD_SECRET }}' | docker secret create db_password -)
|
||||||
|
|
||||||
|
# 4. Desplegar el Stack
|
||||||
echo "Desplegando el stack..."
|
echo "Desplegando el stack..."
|
||||||
docker stack deploy \
|
docker stack deploy \
|
||||||
-c /opt/gestion-integral/docker-compose.yml \
|
-c /opt/gestion-integral/docker-compose.yml \
|
||||||
--with-registry-auth \
|
--with-registry-auth \
|
||||||
gestion-integral
|
gestion-integral
|
||||||
|
|
||||||
# 4. Limpieza
|
# 5. Limpieza (sin cambios)
|
||||||
echo "Realizando limpieza..."
|
echo "Realizando limpieza..."
|
||||||
rm -rf "$TEMP_DIR"
|
rm -rf "$TEMP_DIR"
|
||||||
docker image prune -af --filter "until=24h"
|
docker image prune -af --filter "until=24h"
|
||||||
|
|
||||||
echo "--- DESPLIEGUE COMPLETADO CON ÉXITO ---"
|
echo "--- DESPLIEGUE COMPLETADO CON ÉXITO ---"
|
||||||
echo "Tiempo total: $(($SECONDS / 60)) minutos y $(($SECONDS % 60)) segundos"
|
|
||||||
EOSSH
|
EOSSH
|
||||||
Reference in New Issue
Block a user