plain text variable containing the private key
This commit is contained in:
+6
-1
@@ -188,7 +188,12 @@ deploy_to_vps:
|
|||||||
- apk add --no-cache openssh-client
|
- apk add --no-cache openssh-client
|
||||||
# Load the SSH private key stored in the CI variable SSH_PRIVATE_KEY
|
# Load the SSH private key stored in the CI variable SSH_PRIVATE_KEY
|
||||||
- eval $(ssh-agent -s)
|
- 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
|
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||||
# Scan and trust the VPS host key (avoids manual known_hosts management)
|
# Scan and trust the VPS host key (avoids manual known_hosts management)
|
||||||
- ssh-keyscan -H $VPS_IP >> ~/.ssh/known_hosts
|
- ssh-keyscan -H $VPS_IP >> ~/.ssh/known_hosts
|
||||||
|
|||||||
Reference in New Issue
Block a user