fix(ci): add UserKnownHostsFile=/dev/null and target gitea_ci_key to fix read-only ssh error
AS Talange CI/CD Pipeline / Build & Run Unit Tests (push) Successful in 5m1s
AS Talange CI/CD Pipeline / Deploy to Test Environment (push) Successful in 2m2s

This commit is contained in:
2026-09-03 14:05:44 +02:00
parent af47025893
commit 801fbd359d
+9 -1
View File
@@ -135,7 +135,15 @@ jobs:
-e DEST_DIR="${DEST_DIR}" \ -e DEST_DIR="${DEST_DIR}" \
alpine:latest sh -c ' alpine:latest sh -c '
apk add --no-cache openssh-client rsync && \ apk add --no-cache openssh-client rsync && \
SSH_CMD="ssh -p ${PORT} -o StrictHostKeyChecking=no -o ConnectTimeout=15" && \ KEY_ARG="" && \
if [ -f /root/.ssh/gitea_ci_key ]; then \
KEY_ARG="-i /root/.ssh/gitea_ci_key -o IdentitiesOnly=yes" ; \
elif [ -f /root/.ssh/id_ed25519 ]; then \
KEY_ARG="-i /root/.ssh/id_ed25519 -o IdentitiesOnly=yes" ; \
elif [ -f /root/.ssh/id_rsa ]; then \
KEY_ARG="-i /root/.ssh/id_rsa -o IdentitiesOnly=yes" ; \
fi && \
SSH_CMD="ssh -p ${PORT} ${KEY_ARG} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=15" && \
echo "Deploying backup script and .env to DB Server (${TARGET_USER}@${TARGET_HOST}:${DEST_DIR})..." && \ echo "Deploying backup script and .env to DB Server (${TARGET_USER}@${TARGET_HOST}:${DEST_DIR})..." && \
$SSH_CMD "${TARGET_USER}@${TARGET_HOST}" "mkdir -p ${DEST_DIR}/scripts" && \ $SSH_CMD "${TARGET_USER}@${TARGET_HOST}" "mkdir -p ${DEST_DIR}/scripts" && \
rsync -avz -e "$SSH_CMD" scripts/backup_db.sh "${TARGET_USER}@${TARGET_HOST}:${DEST_DIR}/scripts/" && \ rsync -avz -e "$SSH_CMD" scripts/backup_db.sh "${TARGET_USER}@${TARGET_HOST}:${DEST_DIR}/scripts/" && \