From 484ff86b0a30dca81d0d942f03add26b42d544b6 Mon Sep 17 00:00:00 2001 From: "maxime.rocher" Date: Fri, 10 Jan 2025 11:18:44 +0100 Subject: [PATCH] test drone --- .drone.yml | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.drone.yml b/.drone.yml index f3ce6f5..626af04 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,26 +1,32 @@ kind: pipeline type: docker -name: Deploiement - -trigger: - event: - - push +name: default steps: - - name: deploy-container-postgresql + # 1. Déploiement du conteneur PostgreSQL + - name: deploy-container-postgres image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest environment: - IMAGENAME: postgres:17-alpine - CONTAINERNAME: wf-database + IMAGENAME: postgres:13 # Choix de l'image PostgreSQL + CONTAINERNAME: mypostgres # Nom du conteneur COMMAND: create - OVERWRITE: false PRIVATE: true CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD: - from_secret: POSTGRES_PASSWORD - CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB: - from_secret: POSTGRES_DB + from_secret: db_password CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER: - from_secret: POSTGRES_USER - CODEFIRST_CLIENTDRONE_ENV_TRAEFIK_LABELS: true - ADMINS: marocher8, maximerocher , kentinbrongniart + from_secret: db_user + CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB: + from_secret: db_database + # 2. Initialisation de la base de données avec init.sql + - name: init-database + image: postgres:13 + environment: + # Utilisation des mêmes secrets pour se connecter + PGPASSWORD: + from_secret: db_password + commands: + # Attendre que le service PostgreSQL soit disponible + - until pg_isready -h mypostgres -U ${POSTGRES_PASSWORD}; do sleep 1; done + # Exécuter le script d'initialisation + - psql -h mypostgres -U ${POSTGRES_USER} -d ${POSTGRES_PASSWORD} -f init.sql