fix(ci): add UserKnownHostsFile=/dev/null and target gitea_ci_key to fix read-only ssh error
This commit is contained in:
@@ -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/" && \
|
||||||
|
|||||||
Reference in New Issue
Block a user