hcloud-tests/.drone.yml
Patrick Michl fc158c2a25
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
chmod
2022-02-20 23:23:15 +01:00

36 lines
1.2 KiB
YAML

kind: pipeline
type: docker
name: hcloud
steps:
- name: check requirements
image: alpine
commands:
- '[ -n "$SERVER_ID" ]'
- name: archinstall
image: alpine
environment:
HCLOUD_TOKEN:
from_secret: hcloud_token
SSH_PUBKEY:
from_secret: ssh_pubkey
commands:
- 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 delete drone || true
- ./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
- scp install-arch.sh root@"$IP":/root/install-arch.sh
- echo "$SSH_PUBKEY" > authorized_keys
- scp authorized_keys root@"$IP":/root/authorized_keys
- ssh root@$IP chmod +x /root/install-arch.sh
- ssh root@$IP /root/install-arch.sh
- ./hcloud server reset $SERVER_ID
- ./hcloud ssh-key delete drone
- until ping -c 1 "$IP"; do sleep 5; done