From 570a58477a48924b937649650b370fcf8c59b57b Mon Sep 17 00:00:00 2001 From: root Date: Wed, 3 Jun 2026 00:35:04 -0400 Subject: [PATCH] plain text variable containing the private key --- .gitlab-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 338ad8f..b96ab88 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -188,7 +188,12 @@ deploy_to_vps: - apk add --no-cache openssh-client # Load the SSH private key stored in the CI variable SSH_PRIVATE_KEY - eval $(ssh-agent -s) - - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + - | + if [ -f "${SSH_PRIVATE_KEY:-}" ]; then + tr -d '\r' < "$SSH_PRIVATE_KEY" | ssh-add - + else + printf '%s\n' "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + fi - mkdir -p ~/.ssh && chmod 700 ~/.ssh # Scan and trust the VPS host key (avoids manual known_hosts management) - ssh-keyscan -H $VPS_IP >> ~/.ssh/known_hosts