start server into rescue and wait for it to come onlin
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Patrick Michl 2022-02-17 23:09:49 +01:00
parent cbd5d76196
commit 91a9d19e9a

View File

@ -8,21 +8,22 @@ steps:
commands:
- '[ -n "$SERVER_ID" ]'
- name: get hcloud
image: alpine
commands:
- apk add -U curl
- curl -L https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz | tar zx
- name: hcloud
image: alpine
environment:
HCLOUD_TOKEN:
from_secret: hcloud_token
commands:
# - apk add openssh
- echo $SERVER_ID
# - ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -q -N ''
# - ./hcloud ssh-key create --name drone --public-key-from-file /root/.ssh/id_ed25519.pub
# - ./hcloud server list
# - ./hcloud ssh-key delete drone
- apk add -U openssh
- wget -O- https://github.com/hetznercloud/cli/releases/latest/download/hcloud-linux-amd64.tar.gz | tar zx
- ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -q -N ''
- ./hcloud ssh-key create --name drone --public-key-from-file /root/.ssh/id_ed25519.pub
- ./hcloud server enable-rescue $SERVER_ID --ssh-key drone
- ./hcloud server reset $SERVER_ID
- IP="$(hcloud server ip "$SERVER_ID")"
- until ping -c 1 "$IP"; do sleep 5; done
- until ssh-keyscan "$IP" > /root/.ssh/known_hosts; do sleep 5; done
- echo "ssh root@$IP \"\$@\"" > ssh
- chmod +x ssh
- ./ssh
- ./hcloud ssh-key delete drone