fix(ci): strict regular file check and explicit error message when PROD_DB_SSH_KEY is missing
AS Talange CI/CD Pipeline - Production / Build & Run Unit Tests (push) Successful in 2m7s
AS Talange CI/CD Pipeline - Production / Deploy to Prod Environment (push) Failing after 1m14s

This commit is contained in:
2026-09-03 15:39:35 +02:00
parent 9990bba799
commit 5fb6356f8a
+6 -3
View File
@@ -130,7 +130,7 @@ jobs:
DEST_DIR="/opt/as-talange" DEST_DIR="/opt/as-talange"
RAW_KEY="${PROD_DB_SSH_KEY:-${SSH_KEY_PATH_SECRET:-${SSH_KEY_SECRET}}}" 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 if [ -n "${RAW_KEY}" ]; then
printf "%s\n" "${RAW_KEY}" | tr -d '\r' | sed 's/\\n/\n/g' > /tmp/gitea_runner_key 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 elif [ -f /root/.ssh/gitea_ci_key ]; then
@@ -139,8 +139,11 @@ jobs:
cp /home/ucef/.ssh/gitea_ci_key /tmp/gitea_runner_key cp /home/ucef/.ssh/gitea_ci_key /tmp/gitea_runner_key
fi fi
if [ ! -s /tmp/gitea_runner_key ]; then if [ ! -f /tmp/gitea_runner_key ] || [ ! -s /tmp/gitea_runner_key ]; then
echo "ERROR: Secret PROD_DB_SSH_KEY is empty or not defined in Gitea!" 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 exit 1
fi fi
chmod 600 /tmp/gitea_runner_key chmod 600 /tmp/gitea_runner_key