From 5fb6356f8a50acd3a14d1f1946d007b454c44794 Mon Sep 17 00:00:00 2001 From: Youssef Date: Thu, 3 Sep 2026 15:39:35 +0200 Subject: [PATCH] fix(ci): strict regular file check and explicit error message when PROD_DB_SSH_KEY is missing --- .gitea/workflows/ci-prod.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci-prod.yml b/.gitea/workflows/ci-prod.yml index c1a8785..557a69d 100644 --- a/.gitea/workflows/ci-prod.yml +++ b/.gitea/workflows/ci-prod.yml @@ -130,7 +130,7 @@ jobs: DEST_DIR="/opt/as-talange" RAW_KEY="${PROD_DB_SSH_KEY:-${SSH_KEY_PATH_SECRET:-${SSH_KEY_SECRET}}}" - rm -f /tmp/gitea_runner_key + rm -rf /tmp/gitea_runner_key if [ -n "${RAW_KEY}" ]; then printf "%s\n" "${RAW_KEY}" | tr -d '\r' | sed 's/\\n/\n/g' > /tmp/gitea_runner_key elif [ -f /root/.ssh/gitea_ci_key ]; then @@ -139,8 +139,11 @@ jobs: cp /home/ucef/.ssh/gitea_ci_key /tmp/gitea_runner_key fi - if [ ! -s /tmp/gitea_runner_key ]; then - echo "ERROR: Secret PROD_DB_SSH_KEY is empty or not defined in Gitea!" + if [ ! -f /tmp/gitea_runner_key ] || [ ! -s /tmp/gitea_runner_key ]; then + echo "=========================================================================" + echo "ERREUR : Le secret PROD_DB_SSH_KEY est vide ou introuvable dans Gitea !" + echo "Veuillez ajouter la clé privée dans Gitea > Dépôt > Paramètres > Secrets > PROD_DB_SSH_KEY" + echo "=========================================================================" exit 1 fi chmod 600 /tmp/gitea_runner_key