fix(ci): strict regular file check and explicit error message when PROD_DB_SSH_KEY is missing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user