rename ssh_key to DRONE_SSH_KEY

This commit is contained in:
Brad Rydzewski 2020-11-06 09:10:13 -05:00 committed by GitHub
parent e8ff70dc6a
commit 6950125511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,22 +15,13 @@ password ${DRONE_NETRC_PASSWORD}
EOF EOF
fi fi
# Either of SSH_KEY or DRONE_SSH_KEY environment variable represents ssh key.
# DRONE_SSH_KEY variable is introduced to avoid collision with the user provided
# environment variable which can be same as SSH_KEY
ssh_key=$DRONE_SSH_KEY
if [[ -z "${ssh_key}" ]]; then
ssh_key=$SSH_KEY
fi
# if the ssh_key environment variable exists, write # if the ssh_key environment variable exists, write
# the ssh key and add the netrc machine to the # the ssh key and add the netrc machine to the
# known hosts file. # known hosts file.
if [[ ! -z "${ssh_key}" ]]; then if [[ ! -z "${DRONE_SSH_KEY}" ]]; then
mkdir /root/.ssh mkdir /root/.ssh
echo -n "$ssh_key" > /root/.ssh/id_rsa echo -n "$DRONE_SSH_KEY" > /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa chmod 600 /root/.ssh/id_rsa
touch /root/.ssh/known_hosts touch /root/.ssh/known_hosts