More deploy messages, fix mkdir -p issue
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Adam Štrauch 2021-10-27 01:20:26 +02:00
parent 2640690cc6
commit 65bdabd78c
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -3,7 +3,7 @@ type: docker
name: testing
steps:
- name: test
- name: unittests
image: golang:1.17-buster
environment:
SNAPSHOTS_S3_ENDPOINT: minio:9000
@ -42,16 +42,24 @@ steps:
image: debian:buster
environment:
#NODE: node-x.rosti.cz
NODE: 192.168.1.236
NODES: 192.168.1.236
SSH_KEY:
from_secret: SSH_KEY
commands:
- apt update && apt install -y ssh
- mkdir ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan $NODE > ~/.ssh/known_hosts
- scp node-api root@$NODE:/usr/local/bin/node-api_
- ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
- ssh root@$NODE systemctl restart node-api
- |
for NODE in $NODES; do
echo "\033[0;32mDeploying $NODE\033[0m"
mkdir -p ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
echo "\033[1;33m.. scanning SSH keys\033[0m"
ssh-keyscan $NODE > ~/.ssh/known_hosts
echo "\033[1;33m.. copying the binary\033[0m"
scp node-api root@$NODE:/usr/local/bin/node-api_
echo "\033[1;33m.. replacing the binary\033[0m"
ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
echo "\033[1;33m.. restarting service file\033[0m"
ssh root@$NODE systemctl restart node-api
done
trigger:
branch:
@ -89,10 +97,14 @@ steps:
- |
for NODE in $NODES; do
echo "\033[0;32mDeploying $NODE\033[0m"
mkdir ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
mkdir -p ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
echo "\033[1;33m.. scanning SSH keys\033[0m"
ssh-keyscan $NODE > ~/.ssh/known_hosts
echo "\033[1;33m.. copying the binary\033[0m"
scp node-api root@$NODE:/usr/local/bin/node-api_
echo "\033[1;33m.. replacing the binary\033[0m"
ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
echo "\033[1;33m.. restarting service file\033[0m"
ssh root@$NODE systemctl restart node-api
done